public static void MessageSystemUnregister <U>(this U receiver) where U : MonoBehaviour { foreach (var inter in typeof(U).GetInterfaces().Where( i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(Receiver <>))) { var messageType = inter.GetGenericArguments().First(); MessageSystem.GetMessageSystem()?.unregisterReceiver(messageType, receiver); } }
public static void MessageSystemPush <T>(this MonoBehaviour sender, T message) { MessageSystem.GetMessageSystem()?.pushMessage(message, sender.gameObject); return; }