We are using UnityEvent for our in-game menu but we ran into some issues when trying to use it in a nested struct for sub menus. It works fine in the top level struct but breaks in the sub level structs.
public class TestScript : MonoBehaviour
{
[Serializable]
public struct menuItem
{
public UnityEvent menuEvent;
public menuItem[] subMenu;
}
public menuItem[] menuItems;
}
It throws the following error
type is not a enum value UnityEditor.SerializedProperty:get_enumValueIndex() UnityEditorInternal.UnityEventDrawer:GetMode(SerializedProperty) (at C:/buildslave/unity/build/Editor/Mono/Inspector/UnityEventDrawer.cs:161) UnityEditorInternal.UnityEventDrawer:DrawEventListener(Rect, Int32, Boolean, Boolean) (at C:/buildslave/unity/build/Editor/Mono/Inspector/UnityEventDrawer.cs:196) UnityEditorInternal.ReorderableList:DoListElements(Rect) (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:576) UnityEditorInternal.ReorderableList:DoList(Rect) (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:401) UnityEditorInternal.UnityEventDrawer:OnGUI(Rect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/UnityEventDrawer.cs:146) UnityEditorInternal.UnityEventDrawer:OnGUI(Rect, SerializedProperty, GUIContent) (at C:/buildslave/unity/build/Editor/Mono/Inspector/UnityEventDrawer.cs:115) UnityEditor.DockArea:OnGUI()
Is this a known issue and if so does anyone know how to fix this or know of a work around?