版本:Unity 6 (6000.0)
语言英语
  • C#

AnimatorClipInfo.clip

建议更改

成功!

感谢你帮助我们提高 Unity 文档的质量。尽管我们无法接受所有内容,但我们确实会阅读我们用户提出的每项建议更改,并会在适用时进行更新。

关闭

提交失败

由于某种原因,你的建议更改未提交成功。请<a>在几分钟后重试</a>。感谢你花时间帮助我们改进 Unity 文档的质量。

关闭

取消

public 动画剪辑 clip;

描述

返回 Animator 播放的动画剪辑。

//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 Example : MonoBehaviour { Animator m_Animator; AnimatorClipInfo[] m_AnimatorClipInfo;

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