InlineEditor destroy exception for nested editors

Issue #785 resolved
Gamer XP created an issue

When you use nested InlineEditors - it throws exception when reloading assemblies:

NullReferenceException: SerializedObject of SerializedProperty has been Disposed.
UnityEditor.SerializedProperty.Verify (UnityEditor.SerializedProperty+VerifyFlags verifyFlags) (at <4cbd678da9d34d10b88d29af4998c9e0>:0)
UnityEditor.SerializedProperty.get_stringValue () (at <4cbd678da9d34d10b88d29af4998c9e0>:0)
UnityEditor.GameObjectInspector.OnDisable () (at <4cbd678da9d34d10b88d29af4998c9e0>:0)
UnityEngine.Object:DestroyImmediate(Object)
Sirenix.OdinInspector.Editor.Drawers.InlineEditorAttributeDrawer`1:DestroyEditors() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/InlineEditorAttributeDrawer.cs:420)
Sirenix.OdinInspector.Editor.Drawers.InlineEditorAttributeDrawer`1:System.IDisposable.Dispose() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/InlineEditorAttributeDrawer.cs:466)
Sirenix.OdinInspector.Editor.InspectorProperty:DisposeExistingSetup() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1595)
Sirenix.OdinInspector.Editor.InspectorProperty:Dispose() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1491)
Sirenix.OdinInspector.Editor.InspectorProperty:DisposeExistingSetup() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1680)
Sirenix.OdinInspector.Editor.InspectorProperty:Dispose() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1491)
Sirenix.OdinInspector.Editor.PropertyTree:ActuallyDispose() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:991)
Sirenix.OdinInspector.Editor.PropertyTree:Dispose(Boolean) (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:974)
Sirenix.OdinInspector.Editor.PropertyTree:Dispose() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:986)
Sirenix.OdinInspector.Editor.OdinEditor:OnDisable() (at Y:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:144)

How to reproduce:

Create such a script

using Sirenix.OdinInspector;
using UnityEngine;

public class Tests : MonoBehaviour
{
    [InlineEditor]
    public Tests Nested;
}

Then add few of them, then make them reference each other (make sure they don’t loop though).

https://gyazo.com/ecb1a2e2d28eef6e44bee76a8b03f7f0

Lock the inspector, and reload some script - it throws exception from above when scripts finish reloading.

I’m not using EditorOnly mode, system is Windows 10.

Comments (1)

  1. Tor Esa Vestergaard

    Thank you for reporting this issue! :)

    A fix for this is already in the release branch for the 3.0.6 release, which should be coming some time in the next month. If you need a preview of the next patch build, please contact us on our Discord server.

  2. Log in to comment