Created
August 2, 2018 17:56
-
-
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.
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
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