Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null reference exception when clicking on the DeButton of an unselected object #11

Closed
ehakram opened this issue Mar 15, 2019 · 4 comments
Assignees
Labels

Comments

@ehakram
Copy link

ehakram commented Mar 15, 2019

(reproduced with latest version of DeInspektor and Unity 2018.3)

1- Have an object with a DeButton in its inspector selected
2- lock the inspector
3- deselect the said object
4- click on the DeButton

You will get a null reference error:
NullReferenceException: Object reference not set to an instance of an object
DG.DeInspektorEditor.AttributesManagers.DeButtonPropertyDrawer.OnGUI (UnityEngine.Rect position) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__Demigiant.Libraries/_Demigiant.Libraries/DeInspektorEditor/AttributesManagers/DeButtonPropertyDrawer.cs:60)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:123)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:106)
UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:208)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:9233)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:9227)
DG.DeInspektorEditor.DeInspektor.DrawDefault (UnityEditor.SerializedProperty iterator, System.Boolean isArrayElement, System.Int32 arrayElementIndex) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__Demigiant.Libraries/_Demigiant.Libraries/DeInspektorEditor/DeInspektor.cs:94)
DG.DeInspektorEditor.DeInspektor.DrawProperty (UnityEditor.SerializedProperty property, System.Boolean isArrayElement, System.Int32 arrayElementIndex) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__Demigiant.Libraries/_Demigiant.Libraries/DeInspektorEditor/DeInspektor.cs:80)
DG.DeInspektorEditor.DeInspektor.Draw (UnityEditor.SerializedObject obj) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__Demigiant.Libraries/_Demigiant.Libraries/DeInspektorEditor/DeInspektor.cs:68)
DG.DeInspektorEditor.DeInspektor.OnInspectorGUI () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__Demigiant.Libraries/_Demigiant.Libraries/DeInspektorEditor/DeInspektor.cs:47)
UnityEditor.InspectorWindow.DoOnInspectorGUI (System.Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, System.Boolean wasVisible, UnityEngine.Rect& contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

@ehakram
Copy link
Author

ehakram commented Mar 15, 2019

Assets.zip
Reproduction scene and script

@Demigiant
Copy link
Owner

Took me a while but I'm checking it out now :P

@Demigiant Demigiant self-assigned this Mar 28, 2019
@Demigiant Demigiant added the bug label Mar 28, 2019
@Demigiant
Copy link
Owner

Pushed an update to all downloads. Now if you try that, I log a warning that tells you that the target must be selected.

I tried capturing the target automatically, but there's various problems there. Especially if you have multiple Inspectors open for clones of the same target, in which case I would have no way to determine which one is the right one. So I'd say that a warning that alerts you to select it is better.

@ehakram
Copy link
Author

ehakram commented Mar 28, 2019

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants