access the animation array in an animation component.

in the inspector of my animation component, i have an big array full of animations. but i don’t see a way in the scripting reference to access them. but i need to check them for their length when they play. if i could access them by name it would really help my script.
is there a way to do that?

i was trying this, but in Unity5 doesnt work it. I dont know, but still some errors.

or what i need is normalizedTime from this state. but [this][1] doesnt work too. [1]: http://docs.unity3d.com/ScriptReference/AnimationState-normalizedTime.html

1 Answer

1

using UnityEngine;
using System.Collections;

public class AnimationExample : MonoBehaviour 
{
	void Start()
	{
		print (animation["Walk"].length);
	}
}

oh man i can't believe its that easy >.< iv been trying to code around that for a day and half. thanks!

Always happy to be of help :D