Animator is not playing an AnimatorController
Animator is not playing an AnimatorController
Your script called SetBool, SetTrigger, Play or similar on an Animator that has no Animator Controller to run, so there is nothing for the call to affect.
Read the Console line first
The warning repeats every frame the call is made. Find the Animator your script uses and look at its Controller field.
Common causes
The Controller field is empty
The Animator component's Controller slot shows None. Drag your Animator Controller asset into it.
The script found the wrong Animator
GetComponent found an Animator on this object, but the one with the controller is on a child model. Use GetComponentInChildren or a serialized field.
The Animator or its object is disabled
A disabled Animator, or one on an inactive GameObject, is not playing its controller.
The fix
[SerializeField] private Animator animator;
void Awake()
{
if (animator == null) animator = GetComponentInChildren<Animator>();
if (animator.runtimeAnimatorController == null)
Debug.LogError("Assign an Animator Controller", animator);
}Stop it coming back
Reference the Animator through a serialized field and check runtimeAnimatorController once in Awake.
Questions
- How do I assign a controller from code?
- Set
animator.runtimeAnimatorController = controller;before calling Play, SetTrigger or other Animator methods. - The controller is assigned. Why is the warning still logged?
- The call may run while the Animator or its GameObject is disabled, for example on a pooled object before it is activated. Make the call after activation, or check
animator.isActiveAndEnabledfirst. - Does the Animation component need a controller?
- No. The legacy Animation component plays clips directly and has no controller. This warning is only about the Animator component.
Related errors
Got a different error? Paste it into the error lookup.