NullRef is thrown if InlineEditor field pointing to a component on a prefab is visible in the inspector on domain reload

Issue #876 new
Tim Aksu created an issue
  1. What happened?

    1. Script compilation causes NullRef to be thrown if you have an inspector open that is showing an inline editor pointing to a component on a prefab asset.
  2. How can we reproduce it?

    1. Create a script with a Transform field with an InlineEditor attribute. Attach script to a game object in your scene. Reference a transform from a prefab within your project. Change a script. Observe exception is thrown.
  3. If screenshots would help explain or demonstrate your issue, please include these.

  4. What version of Unity are you using?

    1. 2021.3.8f1
  5. What version of Odin are you using? (See "Tools > Odin Inspector > About")

    1. 3.1.3.0
  6. Do you have Editor Only mode enabled?

    1. Yes
  7. What operating system are you on?

    1. Windows

Example Script:

using Sirenix.OdinInspector;
using UnityEngine;

public class TestScript : MonoBehaviour
{
    [InlineEditor] public Transform Test;
}

Stacktrace:

NullReferenceException: SerializedObject of SerializedProperty has been Disposed.
UnityEditor.SerializedProperty.get_stringValue () (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
UnityEditor.GameObjectInspector.OnDisable () (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
UnityEngine.Object:DestroyImmediate(Object)
Sirenix.OdinInspector.Editor.Drawers.InlineEditorAttributeDrawer`1:DestroyEditors() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/InlineEditorAttributeDrawer.cs:422)
Sirenix.OdinInspector.Editor.Drawers.InlineEditorAttributeDrawer`1:System.IDisposable.Dispose() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/InlineEditorAttributeDrawer.cs:474)
Sirenix.OdinInspector.Editor.InspectorProperty:DisposeExistingSetup() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1672)
Sirenix.OdinInspector.Editor.InspectorProperty:Dispose() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1568)
Sirenix.OdinInspector.Editor.InspectorProperty:DisposeExistingSetup() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1757)
Sirenix.OdinInspector.Editor.InspectorProperty:Dispose() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1568)
Sirenix.OdinInspector.Editor.PropertyTree:ActuallyDispose() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:1125)
Sirenix.OdinInspector.Editor.PropertyTree:Dispose(Boolean) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:1104)
Sirenix.OdinInspector.Editor.PropertyTree:Dispose() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:1116)
Sirenix.OdinInspector.Editor.OdinEditor:OnDisable() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:176)

Comments (1)

  1. Tim Aksu reporter

    Incorrect version was specified in the Version dropdown. I am using 3.1.3.0. It is not available in the dropdown. I selected the next closest (3.1.0.0)

  2. Log in to comment