Version: 2017.4
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AnimatorClipInfo.clip

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public var clip: AnimationClip;
public AnimationClip clip;

Description

Returns the animation clip played by the Animator.

no example available in JavaScript
//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); } }