How do you get the value of an enum

Hi, noob here.

Creating a custom node and trying to use an enum to allow multiple options on return value for generating levels.

enumValue = ValueInput(“PuzzleObject”, PuzzleObject.test1);

I’m setting up an enumValue variable, which holds a default.

When person changes the enum in the graph how do I get this value back?

puzzleObject = enumValue doesn’t work, and I can’t find a .GetValue option either.

thanks

Well if you are outputting the enum:-

public class MyUnit : Unit
{ …
public ValueOutput output;
… }

protected override void Definition()
{ …
output = ValueOutput(nameof(output), GetPuzzle); // Call GetPuzzle
… }

public PuzzleObject GetPuzzle(Flow flow) // GetPuzzle returns a PuzzleObject to the ValueOutput
{ return flow.GetValue(enumValue); } // From your ValueInput

Can try casting.
(int)PuzzleObject;
(byte)PuzzleObject;
(short)PuzzleObject;
etc.

public enum MyEnum
{
nullEntry = 0,
entry1 = 1,
entry2 = 2;
}
public MyEnum t1;
int number = (int)t1;