I’m using the built-in event messaging system to make method calls on my MonoBehaviour and I noticed there isn’t support for passing an enum (only bool,int,string,float,object).
What I’d like:
public enum MyEnum
{
Foo,
Bar,
Baz
}
public void OnButtonClick(MyEnum value)
{
// Do logic with value
}
In the editor I would just select from the dropdown the readable enum name I want to send for that button.
What I have to do instead:
public void OnButtonClick(int enumCode)
{
MyEnum value = (MyEnum)enumCode;
// Do logic with value
}
In the editor I have to send the proper integer value of the enum which has a lot of room for error and requires you to look up in code what is valid.
Can this feature be added or is there a better way?