Mecanim animation auto playing when "Play Automatically" not checked?

I have an anim I made using Unity’s animation tools. The animation changes the Y value of the rect transform to move a UIPanel down. The animation plays fine, but I can’t get it to stop playing automatically. I have “Play Automatically” unchecked, is there another place to look if my animation is playing automatically when the scene loads?

Here are my settings:

32531-capture.jpg

So, the simple answer is below, but first read this…

Unity uses two basic ways to do animation. The old way was that you put the Animation component into the object you wanted to animate. For complex systems you’d blend and mix Animation Clips in code. The new way is to put an Animator Component and it references the Animation Clip.

Now, it is typical to use the Animation with Clip(s) by itself or the Animator with Controller, but not both.

For now, just check off the Animation component and try it. You can double click on the Animator Controller PanelSearchingForMatch and see if the transitions are set up how you expect. Notice the Animator Controller would use the animation clip ShowSearchingForMatch.

The other option would be just to use the Animation component by itself. Uncheck or remove the Animator Controller component.

Either way, you should go find your Animation (not the Animator Controller) in the Project View. Click on it and uncheck the loop. Here’s one I did (just an elevator that goes up and stops):

32532-upelevatoranimation.png

Finally, there are times when it does make sense to have say an Animation component in a child game object. But, for most cases it really makes sense to use just the Animator Controller and have it reference all the Animations and not use the Animation component explicitly. Or use the Animation component by itself (the old legacy way) and switch clips. I suggest not using both approaches in the same game object.

I created an empty state and made it default (right-click on state for option) so that the animation do not auto-play. I named it “Idle”.

When I need to play the animation I created I simply call Animator.Play with the name of the state that has that clip. To stop the animation I call Animator.Play(“Idle”);

34545-animation.png