timo-sisus / Power-Inspector

Report bugs and offer improvement ideas for Power Inspector.
http://u3d.as/1sNc
7 stars 0 forks source link

"SerializedObject target has been destroyed" console spam on exiting Play Mode #26

Closed ArkyonVeil closed 3 years ago

ArkyonVeil commented 3 years ago

Sometimes when exiting play mode, (SerializedObject target has been destroyed) is spammed to the console several times per second until the object is deselected.

Error trace below:

SerializedObject target has been destroyed. UnityEditor.MeshRendererEditor:OnInspectorGUI() Sisus.CustomEditorBaseDrawer2:DrawOnInspectorGUI(Editor) (at Assets/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/CustomEditorBaseDrawer.cs:1062) Sisus.CustomEditorBaseDrawer2:OnInspectorGUI(Editor) (at Assets/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/CustomEditorBaseDrawer.cs:1012) Sisus.CustomEditorBaseDrawer2:DrawMembers(Rect) (at Assets/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/CustomEditorBaseDrawer.cs:880) Sisus.CustomEditorBaseDrawer2:DrawBody(Rect) (at Assets/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/CustomEditorBaseDrawer.cs:836) Sisus.RendererDrawer:DrawBody(Rect) (at Assets/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/Component/CustomEditor/RendererDrawer.cs:28) Sisus.CustomEditorBaseDrawer2:Draw(Rect) (at Assets/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/CustomEditorBaseDrawer.cs:751) Sisus.GameObjectDrawer:DrawBody(Rect) (at Assets/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/GameObject/GameObjectDrawer.cs:1877) Sisus.GameObjectDrawer:Draw(Rect) (at Assets/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/GameObject/GameObjectDrawer.cs:1687) Sisus.Inspector2:DrawViewport() (at Assets/Sisus/Power Inspector/Code/Editor/Inspector/Core/Inspector.cs:1892) Sisus.Inspector2:DrawViewport(Rect) (at Assets/Sisus/Power Inspector/Code/Editor/Inspector/Core/Inspector.cs:1817) Sisus.PowerInspector:OnGUI(Rect, Boolean) (at Assets/Sisus/Power Inspector/Code/Editor/Inspector/Power Inspector/PowerInspector.cs:139) Sisus.InspectorDrawerWindow2:OnGUI() (at Assets/Sisus/Power Inspector/Code/Editor/EditorWindow/InspectorDrawerWindow.cs:2195) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

On this specific instance it occured to a Meshrenderer but I've also seen it happen to a Line Renderer. Doesn't seem to be causing any issue that I can see, but its rather distracting and worrysome.

-Dev, pretty pls fix.

timo-sisus commented 3 years ago

I was not yet able to completely get rid of this error even after trying several approaches. Since the error originates from an internal Unity Editor it might just be impossible for me to fix this.

However I added a workaround where the inspector's drawers are rebuilt at the first sign of this error, so at least the console shouldn't get endlessly spammed any longer when this occurs. An update with this fix has been submitted to the asset store for approval.