Null ref coming from DragAndDropUtilities.cs

Issue #592 closed
Kostas Zarifis created an issue

This is happening a lot when working with a ScriptableObject structure I have defined that has a lot of Odin attributes on its members.

It doesn’t seem to be corrupting any data, hence the “minor” on the bug.

Thought you might find it useful anyway


NullReferenceException: Object reference not set to an instance of an object

(wrapper dynamic-method) System.Object.UnityEditor.GUIView_getter<current.GetInstanceID()>()

Sirenix.Utilities.Editor.GUIHelper.get_CurrentWindowInstanceID () (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.Utilities.Editor/GUI/GUIHelper.cs:457)

Sirenix.Utilities.Editor.DragAndDropUtilities.ObjectPickerZone (UnityEngine.Rect rect, System.Object value, System.Type type, System.Boolean allowSceneObjects, System.Int32 id) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.Utilities.Editor/GUI/DragAndDrop/DragAndDropUtilities.cs:151)

Sirenix.Utilities.Editor.SirenixEditorFields.UnityPreviewObjectField (UnityEngine.Rect rect, UnityEngine.GUIContent label, UnityEngine.Object value, System.Type type, Sirenix.Utilities.Editor.ObjectFieldAlignment alignment, System.Boolean dragOnly, System.Boolean allowMove, System.Boolean allowSwap, System.Boolean allowSceneObjects) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.Utilities.Editor/GUI/SirenixEditorFields.cs:266)

Sirenix.Utilities.Editor.SirenixEditorFields.UnityPreviewObjectField (UnityEngine.Rect rect, UnityEngine.GUIContent label, UnityEngine.Object value, System.Type objectType, System.Boolean allowSceneObjects, Sirenix.Utilities.Editor.ObjectFieldAlignment alignment) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.Utilities.Editor/GUI/SirenixEditorFields.cs:303)

Sirenix.Utilities.Editor.SirenixEditorFields.UnityPreviewObjectField (UnityEngine.GUIContent label, UnityEngine.Object value, System.Type objectType, System.Boolean allowSceneObjects, System.Single height, Sirenix.Utilities.Editor.ObjectFieldAlignment alignment) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.Utilities.Editor/GUI/SirenixEditorFields.cs:351)

Sirenix.OdinInspector.Editor.Drawers.PreviewFieldAttributeDrawer`1[T].DrawPropertyLayout (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/PreviewFieldAttributeDrawer.cs:44)

Sirenix.OdinInspector.Editor.OdinDrawer.CallNextDrawer (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.ReferenceValueConflictDrawer`1[T].DrawPropertyLayout (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/ReferenceValueConflictDrawer.cs:55)

Sirenix.OdinInspector.Editor.OdinDrawer.CallNextDrawer (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.ReferencePathConflictDrawer`1[T].DrawPropertyLayout (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/ReferencePathConflictDrawer.cs:45)

Sirenix.OdinInspector.Editor.OdinDrawer.CallNextDrawer (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.HideLabelAttributeDrawer.DrawPropertyLayout (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/HideLabelAttributeDrawer.cs:27)

Sirenix.OdinInspector.Editor.OdinDrawer.CallNextDrawer (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.PropertyContextMenuDrawer`1[T].DrawPropertyLayout (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/PropertyContextMenuDrawer.cs:336)

Sirenix.OdinInspector.Editor.OdinDrawer.DrawProperty (UnityEngine.GUIContent label) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176)

Sirenix.OdinInspector.Editor.InspectorProperty.Draw (UnityEngine.GUIContent defaultLabel) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:544)

Rethrow as OdinPropertyException: This error occurred while being drawn by Odin.

Odin Property Path: CharacterPool.$14.#Tabs.#Basic Info.#Main Info.#Portrait.#Face Portrait.SpritePortraitFace

Odin Drawer Chain:

PropertyContextMenuDrawer<Sprite>

HideLabelAttributeDrawer

ReferencePathConflictDrawer<Sprite>

ReferenceValueConflictDrawer<Sprite>

PreviewFieldAttributeDrawer<Sprite>

UnityObjectDrawer<Sprite>

CompositeDrawer.

UnityEngine.Debug:LogException(Exception)

Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:594)

Sirenix.OdinInspector.Editor.Drawers.BoxGroupAttributeDrawer:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Group Drawers/BoxGroupAttributeDrawer.cs:48)

Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176)

Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:544)

Sirenix.OdinInspector.Editor.Drawers.VerticalGroupAttributeDrawer:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Group Drawers/VerticalGroupAttributeDrawer.cs:35)

Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176)

Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:544)

Sirenix.OdinInspector.Editor.Drawers.HorizontalGroupAttributeDrawer:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Group Drawers/HorizontalGroupAttributeDrawer.cs:193)

Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176)

Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:544)

Sirenix.OdinInspector.Editor.Drawers.TabGroupAttributeDrawer:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Group Drawers/TabGroupAttributeDrawer.cs:133)

Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176)

Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:544)

Sirenix.OdinInspector.Editor.Drawers.CompositeDrawer:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/CompositeDrawer.cs:57)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.NullableReferenceDrawer`1:DrawField(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/NullableReferenceDrawer.cs:209)

Sirenix.OdinInspector.Editor.Drawers.NullableReferenceDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/NullableReferenceDrawer.cs:91)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.ReferenceValueConflictDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/ReferenceValueConflictDrawer.cs:55)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.ReferencePathConflictDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/ReferencePathConflictDrawer.cs:45)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.FixUnityNullDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/FixUnityNullDrawer.cs:78)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.ReferenceDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/ReferenceDrawer.cs:106)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.PropertyContextMenuDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/PropertyContextMenuDrawer.cs:336)

Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176)

Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:544)

Sirenix.OdinInspector.Editor.Drawers.CollectionDrawer`1:DrawItem(InspectorProperty, DragHandle, Int32) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/CollectionDrawer.cs:1186)

Sirenix.OdinInspector.Editor.Drawers.CollectionDrawer`1:DrawItems() (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/CollectionDrawer.cs:993)

Sirenix.OdinInspector.Editor.Drawers.CollectionDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/CollectionDrawer.cs:521)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.NullableReferenceDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/NullableReferenceDrawer.cs:95)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.ReferenceValueConflictDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/ReferenceValueConflictDrawer.cs:55)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.ReferencePathConflictDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/ReferencePathConflictDrawer.cs:45)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.FixUnityNullDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/FixUnityNullDrawer.cs:78)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.ReferenceDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/ReferenceDrawer.cs:106)

Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:306)

Sirenix.OdinInspector.Editor.Drawers.PropertyContextMenuDrawer`1:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/PropertyContextMenuDrawer.cs:336)

Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176)

Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:544)

Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/InspectorUtilities.cs:415)

Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean) (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:303)

Sirenix.OdinInspector.Editor.OdinEditor:DrawTree() (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:93)

Sirenix.OdinInspector.Editor.OdinEditor:DrawOdinInspector() (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:215)

Sirenix.OdinInspector.Editor.OdinEditor:OnInspectorGUI() (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:85)

UnityEditor.UIElements.Tooltip:SetTooltip(Single, Single) (at C:/buildslave/unity/build/Editor/Mono/UIElements/Tooltip.cs:19)

Comments (5)

  1. Tor Esa Vestergaard

    We strive to provide the best support experience we can, but reports that lack data, details and reproduction steps are very challenging and time-consuming to investigate and fix. Please, help us help you, by following the guidelines outlined while you are creating an issue report in our issue tracker. This issue has been closed for now, but after you have edited it to follow the submission guidelines, please post again in this issue and we will look at it again.

  2. Kostas Zarifis reporter

    Hey Tor, that’s understandable, but I thought you might be interested in this callstack at the very least in case there’s a very obvious bug in the codebase around this code. As I am sure you know it can take a long time to prepare reproduction steps and attach huge project files etc.

  3. Tor Esa Vestergaard

    Since nobody else has reported this yet, it seems it’s not just a universal issue, hence there is some specific condition for it to happen. At least some information about the version of Odin and the version of Unity and preferably the code of the ScriptableObjects in question would be needed before we can really look at it.

  4. Kostas Zarifis reporter

    Sure, so I’ve gone ahead and updated Odin to 2.1.6 - issue still happening (when you expand an entry of CharacterSpec (now attached) in the ScriptableObject pool that contains these)

    This part of the callstack might be more useful / relevant?

    Rethrow as OdinPropertyException: This error occurred while being drawn by Odin.
    Odin Property Path: CharacterSpecPool.$0.#Tabs.#Basic Info.#Main Info.#Portrait.#Face Portrait.SpritePortraitFace
    Odin Drawer Chain:

    PropertyContextMenuDrawer<Sprite>
    HideLabelAttributeDrawer
    PreviewFieldAttributeDrawer<Sprite>
    UnityObjectDrawer<Sprite>
    CompositeDrawer.
    UnityEngine.Debug:LogException(Exception)
    Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at

    We’re on version 2019.2.9f1

    Thanks!

  5. Log in to comment