No states in Animation component

Have a weird problem with animation component.
I’m trying to iterate through animation clips in it, using states (is there any alternatives?).
There are clips in Animation component, but looks like array of states is empty.
How can i get list of all clips in Animation?

Animation anim = GetComponent<Animation>();
Debug.Log(anim.GetClipCount());
Debug.Log("States in animation:");
foreach (AnimationState state in anim)
{
    Debug.Log(state);
}

2887065--212121--Console.PNG
2887065--212122--Component.PNG

Check your warnings. It’s probably saying that the AnimationClip must be marked as Legacy. One way to this is by changing Inspector into debug-mode, selecting the clip and checking the Legacy-checkbox.