Search Issue Tracker
Fixed in 2022.1.X
Votes
0
Found in
2020.3
2020.3.12f1
2021.1
2021.2
2022.1
Issue ID
1355905
Regression
No
"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
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
- Inconsistent behaviour when interacting with different dropdown types with pointer events on parent Visual Element
- Hidden GameObjects won't re-enable when they have call "DontDestroyOnLoad" function
- Overlay Canvas are rendered on each split-screen camera when HDR is enabled
- [Android] The Player loses focus when using UnityEngine.Handheld.StartActivityIndicator() with Facebook SDK
- Build fails with "Building Library/Bee/artifacts/MacStandalonePlayerBuildProgram/gahcy/hj9mx3z/951.0 failed with output:..." errors when Scripting Backend is set to IL2CPP
Resolution Note (fix version 2022.1):
Fixed in 2022.1.0a15