- changed version to 3.1.0.0
SerializedObject of SerializedProperty has been Disposed. When start play mode (InlineEditor in OdinEditorWindow)
Issue #891
new
#if UNITY_EDITOR
using Sirenix.OdinInspector;
using Sirenix.OdinInspector.Editor;
using UnityEditor;
using UnityEngine;
public class GameManagerWindow: OdinEditorWindow {
[InlineEditor(Expanded = true), ShowIf("gameManager")]
public GameManager gameManager = null;
[MenuItem("Tools/Game Manager")]
public static void ShowWindow() {
GameManagerWindow wnd = GetWindow<GameManagerWindow>();
wnd.titleContent = new GUIContent("Game Manager");
}
public void CreateGUI() {
FindGameManager();
}
[Button]
[HideIf("gameManager")]
public void FindGameManager() {
if (gameManager == null) {
gameManager = FindObjectOfType<GameManager>();
if (gameManager == null) {
Debug.LogError("Cannot find game manager");
}
}
}
}
#endif
I just made simple custom window with OdinEditorWindow.
And When I start play mode in unity, I get the following error:
NullReferenceException: SerializedObject of SerializedProperty has been Disposed.
UnityEditor.SerializedProperty.get_stringValue () (at <5e26277f966d4f80afa5d51573eba699>:0)
UnityEditor.GameObjectInspector.OnDisable () (at <5e26277f966d4f80afa5d51573eba699>:0)
UnityEngine.Object:DestroyImmediate(Object)
Sirenix.OdinInspector.Editor.Drawers.InlineEditorAttributeDrawer`1:DestroyEditors() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/InlineEditorAttributeDrawer.cs:422)
Sirenix.OdinInspector.Editor.Drawers.InlineEditorAttributeDrawer`1:System.IDisposable.Dispose() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/InlineEditorAttributeDrawer.cs:474)
Sirenix.OdinInspector.Editor.InspectorProperty:DisposeExistingSetup() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1672)
Sirenix.OdinInspector.Editor.InspectorProperty:Dispose() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1568)
Sirenix.OdinInspector.Editor.InspectorProperty:DisposeExistingSetup() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1757)
Sirenix.OdinInspector.Editor.InspectorProperty:Dispose() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1568)
Sirenix.OdinInspector.Editor.PropertyTree:ActuallyDispose() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:1128)
Sirenix.OdinInspector.Editor.PropertyTree:Dispose(Boolean) (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:1107)
Sirenix.OdinInspector.Editor.PropertyTree:Dispose() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:1119)
Sirenix.OdinInspector.Editor.OdinEditorWindow:Cleanup() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:1077)
Sirenix.OdinInspector.Editor.OdinEditorWindow:OnDisable() (at W:/Odin/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:1040)
If I delete “InlineEditor(Expanded = true)”, that error doesn't happen.
When relaunch Unity, the first time I start play mode, the error doesn't occur, but the second time it happens.
Unity Version: 2021.3.12f1
Odin Version: 3.1.6, 3.1.7
Comments (1)
-
reporter - Log in to comment