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
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
- [Rendering Debugger] [NewInputSystem] Debug Overlays in Play mode throws InvalidOperationException when using New Input System
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.