Parameter | Description |
---|---|
resetParameters | Set to true to also reset the controller parameters to their default values. When set to false, only the controller state is reset. |
Resets the AnimatorController to its default state.
Use this method to reset the layers in the AnimatorController to their default state.
using UnityEngine; // Press the Spacebar in Play Mode to reset the animator to the default state [RequireComponent(typeof(Animator))] public class AnimatorResetExample : MonoBehaviour { // The Animator component on the GameObject this script is attached to. Animator m_Animator; void Start() { m_Animator = GetComponent<Animator>(); } void Update() { if (Input.GetKeyDown(KeyCode.Space)) { //This will reset the animator to the default state. m_Animator.ResetControllerState(); } } }