I’m working on a project where I want to make interchangeable functions. Basically, I’m making a tool where I want to give the user the ability to select which functions get called for certain events.
I’m using C#, and usually for this sort of event coding you use delegates. But I’ve always found the general syntax for writing and using delegates to be confusing and overly verbose. While going through some tutorials last week, I came across the Action class under the System namespace. I found this class much easier to work with. And as near as I can tell, the class exists just as a means of providing a shorthand alternative to regular delegates. I like the more type-based approach, and the limited argument options aren’t a hindrance.
What I need to know is, are there any issues with using Actions in Unity? From the limited experiments I’ve performed, there don’t seem to be any problems. But before I start leaning on the class too much, I wanted to check to see if anyone was familiar with any reasons why I ought to avoid using the Action class in Unity.