Support for passing enum as event message method property

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?

You can always wrap your enum as an object.

Having the same annoying issue myself. Hopefully we see this feature in the future.

My workaround was to put a script on the button itself with an enum inspector property, point that script where the button would go, and have the button call it’s own script.

same problem here :confused:

2 Likes

2018 year… :frowning:

2 Likes

2019 phew… :frowning:

2 Likes

2020 here…

5 Likes

2021…

2 Likes

2022…

1 Like

2023…

1 Like

2024…

1 Like

This still doesn’t work in 2025