How to call all methods of specific name ?

Hi all. If i create public method with specific name (like OnPlayerFinalyDie), is here some way how to call all of them at same time without reference to objects ?


You could use a C# Interface that implements the method signature, then collect all classes that implement that interface and safely call the method on them.

Otherwise, you can use GameObject.SendMessage (“MethodName”) on all game objects, it’s also “safe” if you don’t require a receiver, but performance wise, not recommended.

An intermediate implementation would be to have a “manager” that collects all objects of types known to implement that method, and use it to “broadcast” the message.