Search Issue Tracker
Fixed in 2022.1.X
"NullReferenceException" is thrown when a MonoBehaviour script that was attached to a GameObject is deleted
Steps to reproduce:
1. Open the attached project "BugRepro.zip"
2. Open Scenes/SampleScene
3. Delete Bug.cs script
4. Select GameObject in the Hierarchy window
5. Observe the Console window
Expected results: No errors are thrown in the Console window
Actual results: "NullReferenceException" is thrown in the Console window
Reproducible with: 2020.3.19f1, 2021.1.21f1, 2021.2.0b12, 2022.1.0a8
Could not test with: 2019.4.30f1 (Scripts are only partially deleted, data is still shown after the deletion)
Note: Only reproducible when "base.DrawDefaultInspector()" function is used
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- The Editor does not recognize button release when first releasing the "LShift" button and then "Numpad2"
- Reflection Probe doesn't load until it's selected in the Hierarchy window when the project has been opened
- "ArgumentNullException" error in the Console when selecting certain ScriptableObjects and entering Play Mode
- Configurable joints become bouncier when setting "Bounciness" below 1
- Prefabs get corrupted when editing Particle System curves
Resolution Note (fix version 2022.1):
Fixed in 2022.1.0a15