Unity 6.3
0 онлайн 59 гостей 3 в системе
Вход

Параметры

Параметр Описание
resetParameters Установите в true, чтобы также сбросить параметры контроллера к значениям по умолчанию. Если установить в false, будет сброшено только состояние контроллера.

Описание

Сброс параметра AnimatorController к значению по умолчанию.

Используйте этот метод для сброса слоев в AnimatorController к их состоянию по умолчанию.

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