/// <summary> /// Add a unique listener to the signal. /// </summary> public void AddListener(SignalDelegate listener) { if (SendSignal != null && SendSignal.GetInvocationList().Contains(listener)) { Debug.LogWarning(string.Format("Signal already has registered the listener {0}", listener.Method.Name)); } SendSignal += listener; }
/// <summary> /// Add a unique listener to the signal. /// </summary> public void AddListener(SignalDelegate listener) { if (SendSignal == null) { SendSignal += listener; } else if (!SendSignal.GetInvocationList().Contains(listener)) { SendSignal += listener; } }