fullinspector icon indicating copy to clipboard operation
fullinspector copied to clipboard

MissingReferenceException (seemingly harmless but common)

Open lazlo-bonin opened this issue 9 years ago • 1 comments

I frequently get the following error, often when I start / stop play mode, or load / unload a scene.

[Exception] MissingReferenceException: The object of type 'Object' 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.
0. FullInspector.Internal.fiLateBindings+EditorUtility.IsPersistent() at Assets/Plugins/FullInspector2/Core/fiLateBindings.cs:161
1. FullInspector.Internal.fiPersistentEditorStorage.Read[fiDropdownGraphMetadataSerializer]() at Assets/Plugins/FullInspector2/Modules/PersistentMetadata/fiPersistentEditorStorage.cs:32
2. FullInspector.Internal.fiPersistentEditorStorageMetadataProvider`2[TItem,TStorage].RestoreData() at Assets/Plugins/FullInspector2/Modules/PersistentMetadata/fiPersistentEditorStorageMetadataProvider.cs:14
3. FullInspector.fiPersistentMetadata.GetMetadataFor() at Assets/Plugins/FullInspector2/Modules/PersistentMetadata/fiPersistentMetadata.cs:52
4. FullInspector.Internal.fiGraphMetadataSerializer`1[TPersistentData].UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize() at Assets/Plugins/FullInspector2/Modules/PersistentMetadata/fiGraphMetadataSerializer.cs:32

lazlo-bonin avatar Jul 12 '16 14:07 lazlo-bonin

I faced this and managed to make it go away. It began after upgrading. Old scenes would show the warning when serializing/de-serializing.

What solved for me was to go to Window -> Full Inspector -> Developer -> View all Scene Game Objects

Then I simply deleted (clicking the X) the full inspector related objects (fiPersistendEditorStorage and fiBackupSceneStorage). They'll be re-created when you use something from Full Inspector in the scene again (like clicking a foldout).

I'm not sure if this isn't doing more harm than good, but so far everything seems to be working normally.

@jacobdufault, is deleting those objects okay?

P.S.:

  • I did the upgrade following the instructions
  • I was able to consistently reproduce this on a new, empty project using Unity 5.4.0p1
  1. Install FullInspector 2.6.2
  2. Have any object inheriting from BaseBehavior on a newly created scene
  3. Save the scene
  4. Open another scene
  5. Upgrade to 2.6.3 or 2.6.4 (from the access page or the store, doesn't matter)
  6. Load the scene created in step 1
  7. Hit play and the warnings will show

During play, if you use the "View all Scene Game Objects" you'll notice that the fi* objects are indeed with their references empty. When you stop, their references will be correctly set, so something happens during serialization/de-serialization that causes the fi* objects already on the scene to lose their references, but only during play mode.

SugoiDev avatar Aug 16 '16 08:08 SugoiDev