I wish to control any given Animator state "Playhead", with a variable - rather than have it play automatically with time. This is for an animation of a hand making a "clench gesture" which will be bound to an analog controller trigger output value.

I have considered the following:

  1. Inside: StateMachineBehaviour.OnStateUpdate method (State machine behavior script attached to a state in the Mechanim graph)

    Call Animator.Play or Animator.CrossFade to play a given clip from a given time with speed set to 0. This should get called every update while in the state.

    The issue with this is that the whole state will stop, then start again which means OnStateEnter and OnStateExit continually fire, rather than just the OnStateUpdate method to control the "Playhead".

  2. Animator.ForceStateNormalizedTime(time)

    This would be fine but it has been depreciated.

  3. Use timers and the Animator speed variable to calculate when to toggle playing a clip at a certain speed such to match the displacement of the trigger. Seems the wrong way to go about it.

  4. Use the legacy animation system

    This works fine but you don't get the perks of Mechanim FSM eg. blend trees.

Since Unity seem to have removed the ability to manipulate the time of a running clip or Mechanim state, it makes me think it's something I shouldn't be doing. Am I going about this the wrong way? Why does it seem difficult to play an animation via something other than the time domain?


1 Answer 1


It sounds like what you really want to use are Blend Trees. Specifically look at 1D Blending, and the Unity tutorial here.

I'm not an animation expert by any stretch, but from my experience with blend trees I would assign a variable for hand clench which you can feed from your controller via a script. Then create 2 static animations (one of a closed hand and another of an open hand) and blend the 2 together based on the variable.

  • \$\begingroup\$ That's the ticket. This suits my needs for this application. Thank you! \$\endgroup\$
    – Rick
    Nov 29, 2016 at 11:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .