Skip to content

Instantly share code, notes, and snippets.

@theWill
Created November 28, 2017 23:24
Show Gist options
  • Save theWill/9a8e1736f2c04daba0fbee8f5934ab9f to your computer and use it in GitHub Desktop.
Save theWill/9a8e1736f2c04daba0fbee8f5934ab9f to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.Events;
namespace faunlily
{
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()
{
//Debug.Log("event raised on " + this.name);
Response.Invoke();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment