Created
September 9, 2018 15:41
-
-
Save johans2/1baf841381ae389d85df14fab1ab7f14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SignalListener : MonoBehaviour { | |
public int maxNum = 5; | |
void Start () { | |
Debug.Log(ToString() + "Adding listener.."); | |
SignalSender.TestSignal.AddListener(OnSignal); | |
} | |
private void OnSignal(string text, int number) { | |
if(number > maxNum) { | |
Debug.Log(ToString() + " Removing listener.."); | |
SignalSender.TestSignal.RemoveListener(OnSignal); | |
} | |
else { | |
Debug.Log(ToString() + " GOT NOTIFICATION -> text: " + text + " number: " + number); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment