Binding generated UXML Enum with C#

Am learning how to do Editor Window w UI Toolkit

UI Toolkit: Inserted Enum
C#: Q’ed Enum, initiated like this:

enum UIstates { listIsEmpty, browseList, editItem, addNEwItem }
debugUIstate = root.Query<EnumField>("debugUIstate");
debugUIstate.Init(UIstates.browseList);

Now Enum shows up in Editor window, with Init state, good!

Question:
How would I get the Enum Value OUT in C#?

Thanks :slight_smile:

var val = debugUIstate.value;

should do the trick. Might need a cast.

We have a built-in sample for EnumField under Windows > UI Toolkit > Samples for more details.

Thanks - there was that problem of the Windows > UI Toolkit > Samples did not appear to show anything other than a list of functions → window had to be resized :wink: