ドキュメント

Unity Engine

Unity Engine

ResetControllerState(bool)

Resets the AnimatorController to its default state.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.AnimationModule
public void ResetControllerState(bool resetParameters = true)

Parameters

resetParameters

Set to true to also reset the controller parameters to their default values. When set to false, only the controller state is reset.

Remarks

Use this method to reset the layers in the AnimatorController to their default state.

Examples

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(); } }}