+1
Fixed

NullReferenceException deep inside Peek when reloading a custom editor window

jakuba 4 weeks ago updated by ijsLauw yesterday at 3:03 a.m. 6

As the title says, I'm sometimes getting the following error after the editor re-compiles code for my custom inspector built using Odin. I don't think I've done anything super fancy, really the window is just a few buttons with a table.

It did definitely happen more than once though.

NullReferenceException: Object reference not set to an instance of an object
Ludiq.Peek.PeekPlugin.get_Configuration () (at Assets/Plugins/Ludiq/Ludiq.Peek/Editor/Plugin/PeekPlugin.cs:38)
Ludiq.Peek.ReferencePropertyDrawer.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Plugins/Ludiq/Ludiq.Peek/Editor/References/ReferencePropertyDrawer.cs:40)
UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at :0)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at :0)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at :0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
Sirenix.OdinInspector.Editor.UnityPropertyHandlerUtility.PropertyHandlerOnGUI (System.Object handler, UnityEngine.Rect rect, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <7dea081a72784609b59970c589e9ef6c>:0)
Sirenix.OdinInspector.Editor.AbstractTypeUnityPropertyDrawer`3[TDrawer,TDrawnType,T].DrawPropertyLayout (UnityEngine.GUIContent label) (at <7dea081a72784609b59970c589e9ef6c>:0)
Sirenix.OdinInspector.Editor.OdinDrawer.CallNextDrawer (UnityEngine.GUIContent label) (at <7dea081a72784609b59970c589e9ef6c>:0)
Sirenix.OdinInspector.Editor.Drawers.PropertyContextMenuDrawer`1[T].DrawPropertyLayout (UnityEngine.GUIContent label) (at <7dea081a72784609b59970c589e9ef6c>:0)
Sirenix.OdinInspector.Editor.OdinDrawer.DrawProperty (UnityEngine.GUIContent label) (at <7dea081a72784609b59970c589e9ef6c>:0)
Sirenix.OdinInspector.Editor.InspectorProperty.Draw (UnityEngine.GUIContent defaultLabel) (at <7dea081a72784609b59970c589e9ef6c>:0)
Rethrow as OdinPropertyException: This error occurred while being drawn by Odin.
Current IMGUI event: Layout
Odin Property Path: Workstations.$1.Workstation
Odin Drawer Chain:
> PropertyContextMenuDrawer
> AbstractTypeUnityPropertyDrawer
> UnityObjectDrawer
> CompositeDrawer.
UnityEngine.Debug:LogException(Exception)
Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent)
Sirenix.OdinInspector.Editor.Drawers.TableListAttributeDrawer:DrawCell(Column, Int32)
Sirenix.OdinInspector.Editor.Drawers.TableListAttributeDrawer:DrawTable()
Sirenix.OdinInspector.Editor.Drawers.TableListAttributeDrawer:DrawPropertyLayout(GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent)
Sirenix.OdinInspector.Editor.Drawers.NullableReferenceDrawer`1:DrawPropertyLayout(GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent)
Sirenix.OdinInspector.Editor.Drawers.FixUnityNullDrawer`1:DrawPropertyLayout(GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent)
Sirenix.OdinInspector.Editor.Drawers.ReferenceDrawer`1:DrawPropertyLayout(GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent)
Sirenix.OdinInspector.Editor.Drawers.PropertyContextMenuDrawer`1:DrawPropertyLayout(GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent)
Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree)
Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean)
Sirenix.OdinInspector.Editor.OdinEditorWindow:DrawEditor(Int32)
Sirenix.OdinInspector.Editor.OdinEditorWindow:DrawEditors()
Sirenix.OdinInspector.Editor.OdinEditorWindow:OnGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Unity Version:
2020.1.2f1
Peek Version:
1.1.8

I have the same issue with Unity 2019.4.8f1 and Odin.

Working on Fix

Hi Jakuba and Kristina,

Thanks for the bug report and sorry for the delay.

It seems that when Odin is enabled, it can sometimes try to render a Peek drawer before Peek has been initialized. I'll investigate as to what causes this and put safeguards in place.

In the mean time, rest assured that this error should not cause any real issue.

Fixed (Unreleased)

I'm trying a tentative fix for the next version. I can't get the error to reproduce reliably, but this should fix it.

That's great, thank you! I can reproduce it somewhat reliably by making a OdinMenuEditorWindow and changing paths in "tree.AddAllAssetsAtPath", so I can test it out.

Fixed

The fix is applied in Peek v.1.1.9.

I'd like to download that update. But can't yet from the assetstore and your archive doesn't allow it (I linked this account to the assetstore invoice but it linked bolt instead of peak (same invoice)...