I am trying to use a C# script to play an animation clip associated with a state starting from some time instance. This snippet of code called in the Update() function throws the error : “Animator does not have animator controller”.
Animator animator = GetComponent<Animator> ();
var controller = (AnimatorController)animator.runtimeAnimatorController;
UnityEditor.Animations.AnimatorStateMachine sm = controller.layers[0].stateMachine;
per_clip_count ++;
float time_var = (float) per_clip_count / (float) (ListLength[clip_index]);
print("sequence time : "+ time_var);
animator.Play(state_name, -1, time_var);