Skip to content

Instantly share code, notes, and snippets.

@Epicguru
Created August 2, 2018 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Epicguru/a9d2215b168b5e1060bd6561053167be to your computer and use it in GitHub Desktop.
Save Epicguru/a9d2215b168b5e1060bd6561053167be to your computer and use it in GitHub Desktop.
Unity script that is placed next to an Animator, and can be used to send events to receivers.
using System;
using UnityEngine;
using UnityEngine.Events;
[RequireComponent(typeof(Animator))]
public class GenericAnimationCallback : MonoBehaviour
{
public AnimCallback UponEvent = new AnimCallback();
public void Event(AnimationEvent e)
{
if(UponEvent != null)
{
UponEvent.Invoke(e);
}
}
}
[Serializable]
public class AnimCallback : UnityEvent<AnimationEvent>
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment