SerializedObject target has been destroyed

I sometimes get this error when I start the game in the editor. I use 2018 2.

“SerializedObject target has been destroyed. UnityEngine.GUIUtilityprocessEvent(Int32, IntPtr)”

The game plays normally as if there are no errors. When i press pause or play (maybe change scenes) it throws this error again. Restarting unity fixes it. I looked for an answer with no luck. Some say it is an editor glitch, others say “delete the library”. But I don’t know. I will release the game in two months. Is it an important error? Should I roll back to an older version of my game? Thanks.

I used my back up files from 3 weeks old. The error happened again. Saving a script file or restarting unity fixes it.

When this error happens, if I change to another program from windows task bar and go back to Unity, it gives two more of this error.

I upgraded to 2018.4. The error happened again. It seems that this error happens if I choose an object from the project file which has a mesh renderer and i switch screens via script. It gives the error when the mesh renderer is open on the inspector panel. If it is not, it doesn’t give the error.

1 Like

I am having the same issue. I also got the error seemingly every frame that my mouse moves within the inspector window for the given object. I made a dummy prefab to test with. Deleted the mesh renderer on it and now it doesn’t seem to happen anymore for any objects. I’m on 2019.4.1

This error got fixed for me when I checked the “Auto Generate” box under “Lighting > Debug Settings”. I’ve seen other say that they had to uncheck it and click “Generate Lighting”. Either way it looks like this option might be the culprit.

1 Like