Events C# in the inspector?

I need events with functions that I could select in the inspector. At first I chose UnityEvents, but I that their performance is not good. I tried C# Actions, but they are not serialized in the inspector. What should I do?

What is it you’re trying to do? There are different alternatives, but they depend on what your intended use case.

1 Like

There are a lot of keys in my game and typing functions for these keys in code is not good idea. So I created a script with an array of KeyCodes and events. I want to serialize these events.

Maybe serialise the UnityEvents like usual and then loop throug the listeners and add them to a regular event?
Don’t think it’s going to be a huge performance issue tho

1 Like

Well, i think this is good idea, thanks!

1 Like