Created
January 25, 2018 23:16
-
-
Save chuwilliamson/0abd2672590e631709abb3956c0acae2 to your computer and use it in GitHub Desktop.
GameEventListener Monobehaviour from Unite 2017
This file contains hidden or 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
//credit to Ryan Hipple Schell Games | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.Events; | |
public class GameEventListener : MonoBehaviour | |
{ | |
public GameEvent Event; | |
public UnityEvent Response; | |
private void OnEnable() | |
{ | |
Event.RegisterListener(this); | |
} | |
private void OnDisable() | |
{ | |
Event.UnregisterListener(this); | |
} | |
public void OnEventRaised() | |
{ | |
Response.Invoke(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment