Skip to content

Commit 21bd06c

Browse files
committed
Add InvalidEnumArrayIndexAttribute
1 parent 33483cb commit 21bd06c

File tree

5 files changed

+323
-209
lines changed

5 files changed

+323
-209
lines changed

Assets/HTC.UnityPlugin/Utility/Container/Editor/EnumArrayDrawer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
7878
target.FillCapacityToLength();
7979
for (int i = 0, imax = arrayLen, ev = target.MinInt; i < imax; ++i, ++ev)
8080
{
81-
if (target.IsDefined(ev))
81+
if (target.IsValidIndex(ev))
8282
{
8383
var element = arrayProp.GetArrayElementAtIndex(i);
84-
var enumName = ObjectNames.NicifyVariableName(target.EnumIntName(ev));
84+
var enumName = ObjectNames.NicifyVariableName(target.EnumName(ev));
8585

8686
position.height = EditorGUI.GetPropertyHeight(element, GUIContent.none, true);
8787
EditorGUI.PropertyField(position, element, new GUIContent(enumName), true);
@@ -111,7 +111,7 @@ public override float GetPropertyHeight(SerializedProperty property, GUIContent
111111
var target = GetTargetObjectOfProperty(property) as EnumArrayBase;
112112
for (int i = 0, imax = Mathf.Min(arrayLen, target.Length); i < imax; ++i)
113113
{
114-
if (target.IsDefined(i + target.MinInt))
114+
if (target.IsValidIndex(i + target.MinInt))
115115
{
116116
result += verticalSpacing + EditorGUI.GetPropertyHeight(arrayProp.GetArrayElementAtIndex(i), GUIContent.none, true);
117117
}

0 commit comments

Comments
 (0)