- Home /
GameObject has been destroyed, but you are still trying to access it.
Ok, so I know this question has been asked a gazillion times. I see many answers for it, stating that the object needs to be checked for null. Which I do.
Here's the thing. This only happens when I have the Animation window open, and my 'main camera' selected.
Small detail: Everything in my 'game window' is a child of the main camera. (space shooter, big landscape, game happens in the context of the camera window) So anything that spawns comes up in the Animation panel as an object that can be animated. It's really difficult to work with the animation window when errors are popping up all over the place.
Here is the error. I hope I'm not missing something silly here. Again, all 'destroy' calls check for null in my scripts.
Thanks in advance for any help received.
....
MissingReferenceException: The object of type 'GameObject' 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.FoldoutObjectState.RefreshAnimatedState (UnityEditor.AnimationHierarchyData data) UnityEditor.FoldoutObjectState.Show (UnityEditor.AnimationHierarchyData data, Int32 level) UnityEditor.FoldoutObjectState.Show (UnityEditor.AnimationHierarchyData data, Int32 level) UnityEditor.FoldoutTree.Refresh (UnityEditor.AnimationHierarchyData data) UnityEditor.AnimationSelection.Refresh () UnityEditor.AnimationWindow.RefreshAnimationSelections () UnityEditor.AnimationWindow.OnGUI () System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
The error is being thrown by Unity's editor code...not yours. I would suggest putting in a bug report with Unity about it. Just go to "Help/Report a Bug" and attach your project to the bug report so they can check it out.
Case opened. Pasting link here for my own reference https://fogbugz.unity3d.com/default.asp?567262_hhmdukgqqffk0a94
I may try a workaround, like detaching everything underneath the camera, and update positions to match the camera via script. #shrug