I have a custom enum, Direction4, which lists the four directions. I tried to draw this in a BaseData:


[EditorFoldout("Entry Directions",
"Define directions on which a Combatant may enter this teleporter.")]
[EditorEndFoldout]
[EditorArray("Add Entry Direction", "", "", "Remove", "", "",
foldoutText = new string[] { "Direction", "", "" }, foldout = true)]
public Direction4[] EntryDirections = new Direction4[] { Direction4.Up };


This displays fine, and I can add and remove array elements. However, when I try to change the value of an element, I get the following error:

ArgumentException: Object of type 'Direction4' cannot be converted to type 'Direction4[]'.
System.RuntimeType.CheckValue (System.Object value, System.Reflection.Binder binder, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <834b2ded5dad441e8c7a4287897d63c7>:0)
System.Reflection.RuntimeFieldInfo.SetValue (System.Object obj, System.Object val, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at <834b2ded5dad441e8c7a4287897d63c7>:0)
System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at <834b2ded5dad441e8c7a4287897d63c7>:0)
GamingIsLove.Makinom.Editor.EditorAutomation+<>c__DisplayClass27_3.<Value>b__1 (System.Int32 selectedIndex) (at <54dd7dcc64dc48c0b3ade1b7ae1aaced>:0)
GamingIsLove.Makinom.Editor.GeneralSelectionPopup+ItemElement.Accepted () (at <54dd7dcc64dc48c0b3ade1b7ae1aaced>:0)
GamingIsLove.Makinom.Editor.BaseSelectionPopup+Element.Show (System.Int32 i) (at <54dd7dcc64dc48c0b3ade1b7ae1aaced>:0)
GamingIsLove.Makinom.Editor.BaseSelectionPopup.ShowList (System.Collections.Generic.List`1[T] list) (at <54dd7dcc64dc48c0b3ade1b7ae1aaced>:0)
GamingIsLove.Makinom.Editor.BaseSelectionPopup.OnGUI (UnityEngine.Rect rect) (at <54dd7dcc64dc48c0b3ade1b7ae1aaced>:0)
UnityEditor.PopupWindow.OnGUI () (at <53ddbed73faf4fe3b980a493ab4e6639>:0)
UnityEditor.HostView.OldOnGUI () (at <53ddbed73faf4fe3b980a493ab4e6639>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.IMGUIContainer.ProcessEvent (UnityEngine.UIElements.EventBase evt) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <215a3d79f22d4716a26783e9b63e881e>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <cffc46fa8b1e4ee1a0e1b35a8d998061>:0)


Is this not supported? How should I render an array of enums?
  • No, enum arrays are currently not supported - they're basically not used anywhere in ORK/Makinom.
    You can wrap that setting in it's own class (extending BaseData) and make an array out of that to work around that.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.