Unity Animator Controller Animation Integration

Our video game development company runs independent projects, jointly creates games with the client and provides additional operational services. Expertise of our team allows us to cover all gaming platforms and develop an amazing product that matches the customer’s vision and players preferences.
Showing 1 of 1 servicesAll 242 services
Unity Animator Controller Animation Integration
Medium
from 1 business day to 1 week
FAQ
Our competencies
What are the stages of Game Development?
Latest works
  • image_games_mortal_motors_495_0.webp
    Game development for Mortal Motors
    663
  • image_games_a_turnbased_strategy_game_set_in_a_fantasy_setting_with_fire_and_sword_603_0.webp
    A turn-based strategy game set in a fantasy setting, With Fire and Sword
    859
  • image_games_second_team_604_0.webp
    Game development for the company Second term
    490
  • image_games_phoenix_ii_606_0.webp
    3D animation - teaser for the game Phoenix 2.
    533

Animation Integration in Unity Animator Controller

Animator Controller is not just a list of animations with transitions. It's a state machine living alongside game logic and with careless setup becomes source of most animation bugs in project: jerky transitions, animations stuck in wrong state, Blend Tree out of sync with movement speed.

Animator Controller Architecture for Real Project

Typical error during project growth: everything in one layer, all states in flat list. Works for prototype with five animations, breaks at thirty. Correct structure—several layers with explicitly assigned Avatar Mask and Blending Mode.

Base Layer—locomotion and idle. All movement from root: Blend Tree by Speed (idle → walk → run → sprint). Root Motion or In-Place—by gameplay requirements. This layer always works.

Upper Body Layer—attacks, aiming, interactions. Avatar Mask: upper body. Blending: Override. Activates on attack state entry, doesn't interrupt lower body locomotion. Important: this layer Weight must be controlled through code (animator.SetLayerWeight(1, 1f)) on activation—otherwise zero-weight layer is completely ignored.

Additive Layer—hit reactions, breathing, aim sway. Blending: Additive. Animations in this layer overlay above everything without replacing. Breathing cycle with 0.02 amplitude on Y-axis on spine—imperceptible directly, but character without it looks static in idle.

Sub-State Machine used for combo systems and complex sequences. Grouping states inside Sub-State Machine makes graph readable and allows reusing same transition logic for multiple characters.

Parameters and Transitions: How Not to Get Jerky

Parameter type affects transition behavior. Float with dampTime 0.1–0.15—for everything speed-related and smooth changes. Bool—for states (isGrounded, isAiming). Trigger—for one-time events (jump, strike). Integer—for state indices (0=idle, 1=walk) but in most cases worse than Float.

Transition settings often left default causing problems:

Has Exit Time—when enabled, transition waits for current animation completion. Good for attacks (don't interrupt mid-swing). Bad for locomotion (character doesn't respond instantly). Enabled by default—need to disable for most states.

Transition Duration—in seconds or normalized time. 0.1–0.25 seconds for most locomotion transitions. 0.05 or less for fast reactions (landing, block reaction). 0—instant transition, needed for death and teleport states.

Interruption Source—determines if new Trigger can interrupt current Transition. Current State—current state can return control. Next State—next state can be interrupted. Both—used in combo systems with cancel window. Ignoring this parameter causes Trigger to be "swallowed" during Transition and attack registration fails.

Blend Tree for Locomotion: Root Motion Setup

1D Blend Tree by Speed—standard for forward movement. But strafing requires 2D Blend Tree. 2D Freeform Directional type gives best result for eight-directional locomotion: forward, backward, left, right and diagonals. Parameters: VelocityX and VelocityZ, updated from code with dampTime.

Compute Thresholds → Compute from Root Motion Speed automatically sets thresholds from clips. Works correctly only if clips have Root Motion. If using In-Place animation—thresholds must be set manually, otherwise Blend Tree interpolates incorrectly.

Layer Sync: if Upper Body Layer uses same states as Base Layer (e.g., separate idle with weapon for upper part), use Sync checkbox on layer. Sync copies State Machine from base layer but allows different Motion for each state. Saves time and doesn't desynchronize transitions.

Animation Rigging Above Animator Controller

Animation Rigging (package com.unity.animation.rigging) adds procedural constraints above key animation. Two Bone IK for legs and arms, Multi-Aim Constraint for head during aiming, Chain IK for tails and hair.

Rig Builder component added on Animator object. Constraints work in Rig layer order—important for dependencies: shoulder first, then forearm, then hand. Each constraint weight (0.0–1.0) managed through code or Animation Curve—convenient for smooth Foot IK enabling on landing.

Integration Timeline

Task Scale Estimated Duration
Basic Animator Controller (idle, walk, run) 4 to 8 hours
Multi-layer controller with combat system 2 to 4 days
Full Animation Rigging integration 3 to 5 days
Existing controller refactoring 1 to 3 days

Cost depends on state count, transition complexity and existing code management. Calculated after project audit.