Skip to main content

Unity Animation Standardization

✍ Last Updated : September 21, 2022

🚪 Prequisite Knowledge (Optional)

Describe Initial Knowledge that reader need to know before reading this article

❓ Key Question / Problem / Issue

Describe what question / Problem / Issue this knowledge should answer

✅ Expected Output/Definition of Done

Define what information you really need and the definition of done

🎁 Resulting Solution

  • When using generic rig, to reuse different animation clips for different characters, the character rig and the animation rigs structure must be the same.
  • When using 2D Freeform Blending with generic rig, locomotion animations (Walk/Run/Dash) need to have synced legs animation (eg, movements start with left leg). [Animator Setup : Movement Layer](Animation Blend Weight Selection By Animation Clip 5dd250479f104d0a98930d1bceda0146.md)
  • Animation Transitions need to be set at certain value (eg 0.3s). This means that every animation’s length need to be at least 0.3s.

Untitled

  • Some animation clip can use fullbody blending and some can use upper-lower body blending. Example : Sword attack animation should use full body animation, but ranged attack can use upper-lower body blending when shooting/aiming while moving. To control which blending will be used, we can use animationEvent. But this means that we need to make sure that the transition into the clip includes the animationEvent (eg, if animationEvent is at 0s, then the transition needs to start at most at 0s) Details : [Animation Blend Weight Selection By Animation Clip](Animation Blend Weight Selection By Animation Clip 5dd250479f104d0a98930d1bceda0146.md)
  • Animation Event helper/editor scripts :

[Animation Clip Event Copier](Animation Clip Event Copier 789235f73a0c46cbb9176bc93dcf1075.md)

[Multi Timeline Animation Event Editor](Multi Timeline Animation Event Editor 7df92441b589429c916cba0b84e2a589.md)

  • Unity doesn’t provide State Machine Behavior OnStateChange to detect when is an Animator State is changing, there are some approach to detect when is Animator State is changing, using OnStateUpdate by detecting animation clip change everyframe, or using other AnimatorState’s OnStateEnter Details : [Detecting Animation State Change in StateMachineBehavior](Detecting Animation State Change in StateMachineBe 68604e4ad1a34952bc54e7e5b3262f4f.md)
  • Some approaches in preventing/cancelling animation events when the animation state is in transition, each has their own pros and cons :

[Preventing AnimationEvent during State Transition](Preventing AnimationEvent during State Transition deaa6df65d4949fbb94d5c453a334032.md)

[Preventing AnimationEvent using Animator IsInTransition flag](Preventing AnimationEvent using Animator IsInTrans 472d9057dcbe422c86543e5eac2a03e7.md)

[Preventing AnimationEvent during State Transition by not using State Machine Behavior](Preventing AnimationEvent during State Transition 0a9e4848ef1e4da68614dffb7a08f42b.md)

  • If there are multiple listener with the same name but different parameter, Unity Animation Event will trigger only one corresponding function, starting from function with int parameter, float parameter, string, and lastly object ref parameter. The function can also receive AnimationEvent parameter

Untitled