0
Fixed

Unity Editor NullReferenceException when clicking on GameObjects

AndreS vor 2 Jahren in realvirtual.io Starter and Professional aktualisiert von Support vor 2 Jahren 3

Hello,

i am experiencing NullReferenceExceptions and out of Bounds - Debug.LogErrors in the Unity Editor with the Game4Automation Professional Package installed.

Steps to recreate the behaviour are 

- take a empty project

- import the G4A Professional 2020.15 package

- click on the "PlasticBox" Gameobject

You will be flooded with following errors:

Image 548


Retrieving array element that was out of bounds
UnityEditor.SerializedProperty:GetArrayElementAtIndex (int)
NaughtyAttributes.Editor.ReorderableListPropertyDrawer/<>c__DisplayClass6_0:b__2 (int) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs:78)
UnityEditorInternal.ReorderableList:CacheIfNeeded ()
UnityEditorInternal.ReorderableList:GetListElementHeight ()
UnityEditorInternal.ReorderableList:DoLayoutList ()
NaughtyAttributes.Editor.ReorderableListPropertyDrawer:OnGUI_Internal (UnityEngine.Rect,UnityEditor.SerializedProperty,UnityEngine.GUIContent) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs:89)
NaughtyAttributes.Editor.SpecialCasePropertyDrawerBase:OnGUI (UnityEngine.Rect,UnityEditor.SerializedProperty) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs:32)
NaughtyAttributes.Editor.NaughtyEditorGUI:PropertyField_Implementation (UnityEngine.Rect,UnityEditor.SerializedProperty,bool,NaughtyAttributes.Editor.NaughtyEditorGUI/PropertyFieldFunction) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/Utility/NaughtyEditorGUI.cs:47)
NaughtyAttributes.Editor.NaughtyEditorGUI:PropertyField_Layout (UnityEditor.SerializedProperty,bool) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/Utility/NaughtyEditorGUI.cs:29)
NaughtyAttributes.Editor.NaughtyInspector:DrawSerializedProperties () (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/NaughtyInspector.cs:87)
NaughtyAttributes.Editor.NaughtyInspector:OnInspectorGUI () (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/NaughtyInspector.cs:47)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)


NullReferenceException: Object reference not set to an instance of an object
UnityEditor.PropertyHandler.GetHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <3371b3e2e5754acd87e600e068350da5>:0)
UnityEditor.EditorGUI.GetPropertyHeightInternal (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <3371b3e2e5754acd87e600e068350da5>:0)
UnityEditor.EditorGUI.GetPropertyHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <3371b3e2e5754acd87e600e068350da5>:0)
UnityEditor.EditorGUI.GetPropertyHeight (UnityEditor.SerializedProperty property) (at <3371b3e2e5754acd87e600e068350da5>:0)
NaughtyAttributes.Editor.ReorderableListPropertyDrawer+<>c__DisplayClass6_0.b__2 (System.Int32 index) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs:78)
UnityEditorInternal.ReorderableList.CacheIfNeeded () (at <3371b3e2e5754acd87e600e068350da5>:0)
UnityEditorInternal.ReorderableList.GetListElementHeight () (at <3371b3e2e5754acd87e600e068350da5>:0)
UnityEditorInternal.ReorderableList.DoLayoutList () (at <3371b3e2e5754acd87e600e068350da5>:0)
NaughtyAttributes.Editor.ReorderableListPropertyDrawer.OnGUI_Internal (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs:89)
NaughtyAttributes.Editor.SpecialCasePropertyDrawerBase.OnGUI (UnityEngine.Rect rect, UnityEditor.SerializedProperty property) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs:32)
NaughtyAttributes.Editor.NaughtyEditorGUI.PropertyField_Implementation (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, System.Boolean includeChildren, NaughtyAttributes.Editor.NaughtyEditorGUI+PropertyFieldFunction propertyFieldFunction) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/Utility/NaughtyEditorGUI.cs:47)
NaughtyAttributes.Editor.NaughtyEditorGUI.PropertyField_Layout (UnityEditor.SerializedProperty property, System.Boolean includeChildren) (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/Utility/NaughtyEditorGUI.cs:29)
NaughtyAttributes.Editor.NaughtyInspector.DrawSerializedProperties () (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/NaughtyInspector.cs:87)
NaughtyAttributes.Editor.NaughtyInspector.OnInspectorGUI () (at Assets/game4automation/private/Tools/NaughtyAttributes/Editor/NaughtyInspector.cs:47)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)




My Setup:


- Unity 2020.3.33f1 LTS ( this also occures at the newest released Unity 2021.3 LTS Version )

- an empty Project

What did i try?

- Scripting Define Symbols are set

Image 549

- the "game4automation -> apply standard settings" doesnt change anything

- deleting the current Version of NaughtyAttributes in the folder "Assets/game4automation/private/Tools" and importing the current release of NaughtyAttributes of github to the project

Everything is working as expected in old LTS Versions, like Unity 2020.3.19.

Antwort

Antwort
Fixed

Hi, thanks for the feedback. So it seems that it was indeed a Unity bug.

Gestartet

So updating NaughtyAttributes did not changed anything?

It seems to be related to NaughtyAttributes reorderable list. If you add empty entries into the list like this the error is gone away:

We don't know yet, if it is a bug in Unity 2020.3.33 or if it is a bug in NaughtyAttributes. We will keep an eye on it - check it with the next LTS release - and fix it as soon as there is a solution.

I can reproduce this issue up to Unity version 2020.3.34f1

But with 2020.3.35f1 it seems to be solved.

Antwort
Fixed

Hi, thanks for the feedback. So it seems that it was indeed a Unity bug.