dmitry-ivashenko / StatefulUI

Stateful UI - A library for structured state-based UI development in Unity
MIT License
302 stars 22 forks source link

ArgumentException thrown when StatefulComponent's State/Description list extends beyond window height #20

Closed nosenfield closed 1 month ago

nosenfield commented 1 month ago

Describe the bug When adding new States and Descriptions to a StatefulComponent, there is a limit to how many you can add before encountering an ArgumentException that seems to be based on exceeding the height of the inspector window. Once this occurs items drawn beyond the initial window become permanently inaccessible.

To Reproduce Steps to reproduce the behavior:

  1. Create a new StatefulComponent
  2. Add a new State
  3. Add a new item to the State Description 4a. Repeat steps 2-3 until the State list is long enough to require scrolling down the list in the inspector window OR 4b. Resize your Inspector window to be smaller than the height of the State list and then try scrolling down to the bottom of the list

Expected behavior An unlimited number of States/Descriptions should be able to be added to a StatefulComponent

Screenshots

Screen Shot 2024-07-30 at 2 45 26 PM Screen Shot 2024-07-30 at 2 46 02 PM Screen Shot 2024-07-30 at 2 52 20 PM Screen Shot 2024-07-30 at 2 52 30 PM

Version Unity 2022.3.6f1 StatefulUI 1.0.6

Console Output ArgumentException: Getting control 6's position in a group with only 6 controls when doing repaint Aborting UnityEngine.GUILayoutGroup.GetNext () (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/LayoutGroup.cs:129) UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUILayoutUtility.cs:329) UnityEditor.EditorGUILayout.BeginVertical (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorGUILayout.cs:1841) UnityEditor.EditorGUILayout.BeginVertical (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorGUILayout.cs:1831) StatefulUI.Editor.ReferenceInspectors.StateEditor.OnGUI (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at ./Library/PackageCache/dmitry-ivashenko.statefului@652d6ab859/Editor/ReferenceInspectors/StateEditor.cs:40) UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at /Users/bokken/build/output/unity/unity/Editor/Mono/ScriptAttributeGUI/PropertyDrawer.cs:27) UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at /Users/bokken/build/output/unity/unity/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:182) UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at /Users/bokken/build/output/unity/unity/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:142) 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 /Users/bokken/build/output/unity/unity/Editor/Mono/GUI/ReorderableList.cs:397) UnityEditorInternal.ReorderableList.DoListElements (UnityEngine.Rect listRect, UnityEngine.Rect visibleRect) (at /Users/bokken/build/output/unity/unity/Editor/Mono/GUI/ReorderableList.cs:986) UnityEditorInternal.ReorderableList.DoList (UnityEngine.Rect rect, UnityEngine.Rect visibleRect) (at /Users/bokken/build/output/unity/unity/Editor/Mono/GUI/ReorderableList.cs:774) UnityEditorInternal.ReorderableListWrapper.DrawChildren (UnityEngine.Rect listRect, UnityEngine.Rect headerRect, UnityEngine.Rect sizeRect, UnityEngine.Rect visibleRect, UnityEngine.EventType previousEvent) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/ReorderableListWrapper.cs:242) UnityEditorInternal.ReorderableListWrapper.Draw (UnityEngine.GUIContent label, UnityEngine.Rect r, UnityEngine.Rect visibleArea, System.String tooltip, System.Boolean includeChildren) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/ReorderableListWrapper.cs:195) UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at /Users/bokken/build/output/unity/unity/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:224) UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at /Users/bokken/build/output/unity/unity/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:142) UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/build/output/unity/unity/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:296) UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorGUILayout.cs:2072) UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorGUILayout.cs:2056) StatefulUI.Editor.ReferenceInspectors.StateInspector.OnInspectorGUI () (at ./Library/PackageCache/dmitry-ivashenko.statefului@652d6ab859/Editor/ReferenceInspectors/StateInspector.cs:30) StatefulUI.Editor.ReferenceInspectors.StatesInspector.AfterDrawElement (UnityEditor.SerializedProperty element, System.Int32 index) (at ./Library/PackageCache/dmitry-ivashenko.statefului@652d6ab859/Editor/ReferenceInspectors/StatesInspector.cs:120) StatefulUI.Editor.ReferenceInspectors.ItemsReferenceInspector.OnInspectorGUI () (at ./Library/PackageCache/dmitry-ivashenko.statefului@652d6ab859/Editor/ReferenceInspectors/ItemsReferenceInspector.cs:44) StatefulUI.Editor.Core.StatefulComponentInspector.OnInspectorGUI () (at ./Library/PackageCache/dmitry-ivashenko.statefului@652d6ab859/Editor/Core/ReferenceViewInspector.cs:49) StatefulUI.Editor.Core.StatefulComponentEditor.OnInspectorGUI () (at ./Library/PackageCache/dmitry-ivashenko.statefului@652d6ab859/Editor/Core/ReferenceViewEditor.cs:32) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass72_0.b__0 () (at /Users/bokken/build/output/unity/unity/Editor/Mono/UIElements/Inspector/InspectorElement.cs:713) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

dmitry-ivashenko commented 1 month ago

Thanks for the report! Please try v1.0.7