UIBuilder doesn't accept Enum type

Hi,

I tried to set Type of an EnumField in UIBuilder but each time I get this error

EnumField: Invalid enum type "HMH.Data.Resource.Allocation"
UnityEditor.UIElements.UxmlTraits:Init(VisualElement, IUxmlAttributes, CreationContext)
Unity.UI.Builder.BuilderInspectorAttributes:CallInitOnElement() (at Library/PackageCache/com.unity.ui.builder@0.8.4-preview/Editor/Builder/Inspector/BuilderInspectorAttributes.cs:512)

So is it a bug ? or the builder doesn’t support yet enum type ?

That’s an odd error. I have got Enums working, I did have some trouble to begin with. When I had the binding path in, it correctly figured out the enum type automatically.
For a field that didn’t have a binding path, I added the Type for which I needed to include the assembly.
Lets say it was in an assembly called MyAssembly.EditorEnums, and was MyNameSpace.MyEnum
In the field Type I entered: MynameSpace.MyEnum, MyAssembly.EditorEnums

1 Like