# Animator get number of animations (Unity)

In C#, how would I get the number of animations in an Animator Controller?

So I want to find out how many animations there are in an Animator Controller, and have this number in script.

[SerializeField] Animator animator; int NumberOfNonEmptyStates = animator.runtimeAnimatorController.animationClips.Length;