Version: 2023.2

AnimatorClipInfo

struct in UnityEngine

切换到手册

描述

有关动画器正在播放和混合的剪辑的信息。

//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返回动画器播放的动画剪辑。
weight返回 Animator 用于混合该剪辑的混合权重。
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961