Attaching animations to events

Hi there fellow users!

How could I animate my character and attach the animations to certain events like walking or standing still?

Are you asking about Animation Events which let you trigger code at certain times throughout an animation or how to control the animations themselves with basic scripting?

1 Like

I’m just trying to control animations, yes.When he stands still play an idle animation or when he is running he should play the running animation.That’s all I want to do for now.

I recommend you check out Animancer (link in my signature) which has lots of Examples with detailed instructions on how to use it.

Otherwise just Google something like “how to play animations in Unity” and you’ll find plenty of tutorials that explain how to do it with Unity’s inbuilt systems.

  1. Use Animator Window to setup your character’s Animator Controller.

  2. Add parameters (name them as you wish) and then use those parameters to condition how and when a state transitions to other state. For example, in the picture, transition Idle->Run has a condition that checks if Speed parameter is greater than 0. If that’s true, the transition will happen.

  3. Update your Parameter values via script using Animator methods like SetBool/SetFloat etc.