Animation Events
Create and capture animation events to run functions in code when your animation hits a specific location.
Last updated
Create and capture animation events to run functions in code when your animation hits a specific location.
Last updated
In Airship animation events are passed to Typescript through the AnimationEventListener component. If you add this component to your animator it will pass along events from your animations. For custom data you can create a ScriptableObject of type AnimationEventData.
To setup an event use Unity's animation event system either in the animation clip itself using the animation window, or on an FBX using the inspector window.
Create a new animation event
Give it the function "TriggerEvent" if you have a simple trigger or "TriggerEventObj" if you want to pass more data
Set the triggers key to be whatever you would like to identify it by. Or set the key in the object you are passing in
To create an AnimationEventData object, right click and create in the project window: "Create > Airship > Animation Event Data.
Fill in the event data with whatever information you would like to listen to
To listen to events in Typescript, get the component reference for the AnimationEventListener, then connect to the OnAnimationEvent Signal on Character.animator:
Read more on the