Hi!
I have a custom Editor created with UI Toolkit and just found that when I’m creating the PropertyFields for my editors, if one of the SerializedProperties is an enum and that enum starts at index 1, the inspector gives a script error:
ArgumentException: Default Index is beyond the scope of possible value
UnityEditor.UIElements.PopupField`1[T]..ctor (System.String label, System.Collections.Generic.List`1[T] choices, System.Int32 defaultIndex, System.Func`2[T,TResult] formatSelectedValueCallback, System.Func`2[T,TResult] formatListItemCallback) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.UIElements.PopupField`1[T]..ctor (System.Collections.Generic.List`1[T] choices, System.Int32 defaultIndex, System.Func`2[T,TResult] formatSelectedValueCallback, System.Func`2[T,TResult] formatListItemCallback) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.UIElements.PropertyField.CreateFieldFromProperty (UnityEditor.SerializedProperty property) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.UIElements.PropertyField.Reset (UnityEditor.UIElements.SerializedPropertyBindEvent evt) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.UIElements.PropertyField.ExecuteDefaultActionAtTarget (UnityEngine.UIElements.EventBase evt) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
Example enum
public enum EnumThatFails
{
Thing_1 = 1,
Thing_2 = 2,
Thing_3 = 3
}
public EnumThatFails enumThatFails;