/// <summary> /// Triggers the event for all registeed listeners. /// Should only be called from the main thread. /// </summary> /// <param name="argument">The <see cref="MonoDelegateEvent"/> to pass to the listeners</param> public void invoke(MonoDelegateEvent argument) { // Invoke all listeners foreach (MonoDelegateTarget target in listeners) { target.invoke(argument); } }
// Methods public void invoke(MonoDelegateEvent argument) { // Check for valid reference if (targetScript != null) { // Check for valid method if (string.IsNullOrEmpty(targetMethod) == false) { // Trgger the method targetScript.SendMessage(targetMethod, argument, SendMessageOptions.RequireReceiver); } } }