How do I simply play a 2D animation when a key is pressed?

So apparently “Animation” is outdated, so I’m using “Animator”. I have a spritesheet converted into a list of separate images (frames for the animation), and I drag it into the scene and it automatically creates the animator component and everything works fine. The animation plays and loops. But I can’t for the life of me figure out how to actually control this animation.

I’ve been trying to figure this out all day but every google search gives different answers, which either don’t work, or use the old “Animation” class, or mention using the visual animation editor in some way.

All I want to do is:

  1. Turn off the animation automatically playing on start. There’s no bool for this on the Animator component for some reason.

  2. Play the animation ONLY ONCE whenever I call it to. I’d expect Animator.Play() but by default it loops the animation instead of playing it once. What’s the equivalent for PLAYING ONCE?

I’ve tried enabling/disabling the animator component itself, but it still just loops the animation instead of stopping when it’s done. Can’t figure out how to just play ONCE, not play LOOPING. I’d try stopping it manually, but then how can I check if the animation is completed so that I can disable the component again in the update loop? I tried:

if (animator.enabled && animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1.0f) //Animation at it's end.
    animator.enabled = false;

But for some reason that stops the animator from ever playing again after the first time I play it.

I’d think this is would be something really simple and I’m just overlooking the obvious. I spent all day trying to figure this out. Idk i’m finding it so confusing.

I’m used to something like:
Animation.CurrentFrame (or Animation.CurrentTime)

Whats the unity equivalent for all these basic animation things?

Sorry for the bad formatting. Unity answers undid my paragraphing and smooshed everything together for some reason.