Search Issue Tracker
Duplicate
Votes
0
Found in
5.0.0b10
Issue ID
642722
Regression
Yes
MissingReferenceException when changing script on a component
Steps to repro:
1. Create an empty GameObject
2. Create a new script Test01 and add it to the empty GameObject
3. Create another script Test02
4. Replace the Test01 script on the GameObject with Test02
5. Observe the exeption:
MissingReferenceException: The object of type 'NewBehaviourScript' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEditor.Editor.IsEnabled () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:536)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1046)
UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:933)
UnityEditor.InspectorWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:333)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
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
- [Documentation] useAPKExpansionFiles 2022.3 and 2021.3 documentation descriptions does not match same text of the splitApplicationBinary documentation in 6000.0
- Unable to navigate in the Scene when the Readme.cs script of an Asset exists in the project
- Directional Lights impact Sprites they should not impact when the GameObjects are on different Rendering Layers
- Custom Scene view Context Menu does not bypass the ordinary Context Menu shortcut
- Style Sheets cannot be referenced in a Theme Style Sheet file when the folder that contains the Style Sheet has a pound ("#") symbol in it's name
This is a duplicate of issue #635631