Skip to content

Instantly share code, notes, and snippets.

@chuwilliamson
Created January 25, 2018 23:16
Show Gist options
  • Save chuwilliamson/0abd2672590e631709abb3956c0acae2 to your computer and use it in GitHub Desktop.
Save chuwilliamson/0abd2672590e631709abb3956c0acae2 to your computer and use it in GitHub Desktop.
GameEventListener Monobehaviour from Unite 2017
//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