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:
StateMachineBehaviour.OnStateUpdatemethod (State machine behavior script attached to a state in the Mechanim graph)
Animator.CrossFadeto 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
OnStateExitcontinually fire, rather than just the
OnStateUpdatemethod to control the "Playhead".
This would be fine but it has been depreciated.
Use timers and the
Animatorspeed 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.
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?