Open jessyrobinson opened 3 years ago
Defining a serializable a list of scriptable objects with the Expandable attribute gives you continuous errors:
Expandable
NullReferenceException: Object reference not set to an instance of an object NaughtyAttributes.Editor.PropertyUtility.GetPropertyType (UnityEditor.SerializedProperty property) (at Assets/Packages/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs:182) NaughtyAttributes.Editor.ExpandablePropertyDrawer.OnGUI_Internal (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Packages/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs:70) NaughtyAttributes.Editor.PropertyDrawerBase.OnGUI (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Packages/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs:30) UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditorInternal.ReorderableList+Defaults.DrawElement (UnityEngine.Rect rect, UnityEditor.SerializedProperty element, System.Object listItem, System.Boolean selected, System.Boolean focused, System.Boolean draggable, System.Boolean editable) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditorInternal.ReorderableList.DoListElements (UnityEngine.Rect listRect, UnityEngine.Rect visibleRect) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditorInternal.ReorderableList.DoList (UnityEngine.Rect rect, UnityEngine.Rect visibleRect) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditorInternal.ReorderableListWrapper.Draw (UnityEngine.GUIContent label, UnityEngine.Rect r, UnityEngine.Rect visibleArea, System.Boolean includeChildren) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <9540aba417024bb296674f70fa788b73>:0) UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <9540aba417024bb296674f70fa788b73>:0) NaughtyAttributes.Editor.NaughtyEditorGUI.DrawPropertyField_Layout (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at Assets/Packages/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs:37) NaughtyAttributes.Editor.NaughtyEditorGUI.PropertyField_Implementation (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, System.Boolean includeChildren, NaughtyAttributes.Editor.NaughtyEditorGUI+PropertyFieldFunction propertyFieldFunction) (at Assets/Packages/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs:89) NaughtyAttributes.Editor.NaughtyEditorGUI.PropertyField_Layout (UnityEditor.SerializedProperty property, System.Boolean includeChildren) (at Assets/Packages/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs:27) NaughtyAttributes.Editor.NaughtyInspector.DrawSerializedProperties () (at Assets/Packages/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs:87) NaughtyAttributes.Editor.NaughtyInspector.OnInspectorGUI () (at Assets/Packages/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs:47) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <ab574a2f598240d68c66d280c533b9d3>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
I had the same issues. This is solution:
Defining a serializable a list of scriptable objects with the
Expandable
attribute gives you continuous errors: