AnimatorClipInfo

Unity · Версия 2020.3 LTS · Scripting

AnimatorClipInfo

Описание

Информация о клипе, который воспроизводится и смешивается с помощью Animator.

Смотрите так же: Animator.GetCurrentAnimatorClipInfo и Animator.GetNextAnimatorClipInfo.

//Create a GameObject and attach an Animator component (Click the Add Component button in the Inspector of the GameObject and go to Miscellaneous>Animator). Set up the Animator how you would like.
//Attach this script to the GameObject

//This script outputs the current clip from the Animator to the console
using UnityEngine;

public class AnimationClipInfoClipExample : MonoBehaviour
{
    Animator m_Animator;
    AnimatorClipInfo[] m_AnimatorClipInfo;

    // Use this for initialization
    void Start()
    {
        //Fetch the Animator component from the GameObject
        m_Animator = GetComponent<Animator>();
        //Get the animator clip information from the Animator Controller
        m_AnimatorClipInfo = m_Animator.GetCurrentAnimatorClipInfo(0);
        //Output the name of the starting clip
        Debug.Log("Starting clip : " + m_AnimatorClipInfo[0].clip);
    }
}

Свойства

clip Возвращает анимационный клип, воспроизведенный Animator.
weight Возвращает вес смешивания, используемый Animator для смешивания этого клипа.

Обновлено 17 ноября 2026 г.