Search Issue Tracker
Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.
Postponed
Votes
0
Found in
2018.4
2020.1.0f1
2020.2
Issue ID
1278540
Regression
No
Creating built-in Component Class does not give a warning when using the "new" keyword
How to reproduce:
1. Open the attached "New CharacterController No Warning.zip" project and Scenes/SampleScene scene
2. Enter the Play mode
3. Observe the Console window
Expected result: All built-in Components cause a warning
Actual result: Only calling the "new NewBehaviourScript()" causes a warning
Reproducible with: 2018.4.27f1, 2019.4.11f1, 2020.1.6f1, 2020.2.0b3
Note: Not reproducible when creating MonoBehaviour using the "new" keyword
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
Given that there is no real danger in using new on a Component, we will not add a Runtime check to this part yet.
Instead the plan is to add this as a compile time check. This will also make sure there is no extra checks for components at runtime, and no extra cost.
This would also mean we can do the same trick for MonoBehaviours when this is added.