Skip to content

Instantly share code, notes, and snippets.

@felixprojekt
Last active January 22, 2020 15:56
Show Gist options
  • Save felixprojekt/47cd5fdd02ef6bd40bf4a2782a883a85 to your computer and use it in GitHub Desktop.
Save felixprojekt/47cd5fdd02ef6bd40bf4a2782a883a85 to your computer and use it in GitHub Desktop.
Get Animator clips lengths of current gameObject in Unity
public class ClipsLength : MonoBehaviour
void Start()
{
AnimationClip[] clips = gameObject.GetComponent<Animator>().runtimeAnimatorController.animationClips;
foreach(AnimationClip clip in clips)
{
Debug.Log(clip.name);
Debug.Log(clip.length);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment