I didn’t get answers on Unity Answers, and I don’t want to write it all again, so I will put a link to the question on Unity Answers here: http://answers.unity3d.com/questions/1253520/is-it-possible-to-make-custom-automatically-called.html
I am actually pretty ashamed of myself for just posting it here…it probably didn’t get answers for a reason like the post not being detailed enough, or something else. Though on the other hand…I get here more answers with the same post, so who knows.
Someone asked me to be more specific…I actually don’t see how it could help much, and I do see how it will make the post longer, but if you need extra details, read it.
I have in my game an event that starts/ends a battle. The interface I made that derives from IEventSystemHandler is called “IFighter”, and every object that can get into a fight will implement it. One of the methods this interface has is called “OnBattleEvent”, and it takes a parameter for which event, start or end? I used an enum to do this. It’s because it looked pretty inefficient when I had an OnBattleStart event and OnBattleEnd event. On a completely different script, that is not related at all (except…it is, but it doesn’t implement the interface), I have a method called StartBattle and a method called EndBattle (in that case it makes sense to have them separated). They do things you need to do to actually start a battle, and it also invokes the OnBattleEvent event. The problem is that I don’t know how to do it, since the ExecuteEvent.Event method asks for a target.
I am pretty sure I said it in the original post as well, but in case i didn’t, I will say it again: The reason I don’t use a C# event, or a Unity Event, is because when I use those I must remember to add and remove the method, which is both risky and annoying. So using those automatically called methods is the best.
Of course I could easily do it using an abstract class, but the problem with that is that some of them will have different parent classes. Interfaces are just the best way.