How to make animation preview plays only once?

When designing short UI animation it loops like crazy regardless of clip’s loop time settings when I pressed the play button.

I have been adding a dummy keyframe far back to let it stay still to work, but it was very error prone and I often forgot to remove it. (It affects logic which wait on animation time)

There must be something I overlooked. I mean, I just recently know about “F” key fitting the keyframes for about 5-6 years of using Unity. Ideally I would like to press some key on the keyboard and it previews once.

7 Likes

I know your pain, I would like to know how to preview once too. By the way that “F” key thing was an eye-opener. wow thanks.

Feature request please. Our animator and and recently I myself as well are complaining about the auto-loop behaviour of the animation window every week. This sounds easy enough to implement and keeps us from having to add empty key frames at the end of an animation just to preview it nicely.

1 Like

Now that this is necro’ed, Unity, to demonstrate why this is critical. How we perceive an animation is by time difference and appearance difference. So if at this moment something is here and the next moment it is there, we see that it moved. Moreover it is an integral of movement, much like the concept of impulse in physics. For example :

4791335--457715--ezgif-1-8efd5afd1132.gif 4791335--457718--ezgif-1-73420aa132a5.gif

Notice that the left looks like it is continuously pulsing/breathing, and the right looks like it is bouncing. But in fact it is the same animation.

If the animation is always looping, the “stillness” that is supposed to be at the end could never be seen at design time. The result is we perceive the animation differently than at runtime and couldn’t make correct judgement at design time. Imagine a sine wave-like animation. If it is looping, the integral that produce the impulse feel follows a cosine function. So there is no sharp edge, with the steepest value when sin is 0. However in real use of this animation, there is a big impulse at the end from an integral of the end of an interval of a sine wave, to the constant that comes next. (That is produced by the animation not playing, not actually a part of animation.)

So being able to toggle off the looping is not just a quality of life change, it affects the appearance of the animation that the design tool is not able to accommodate. (perceived, not in the data. since our brain and player’s brain interpret the data as an animation but the Animation tab just evaluates a state at a time.) Of course I don’t know the source code, but I feel like this should be a really easy change for you to add long time ago. (In fact I think looping would require more coding)

Unity prooving itself with cinematic projects is nice, but that doesn’t mean Animation tab is powerful enough for everything because those are not interactive media. The cinematic project may never requires short/reusable animation.

The only thing that does this right is PlayableDirector + None/Hold ending mode of the playable graph. Since PD follows Playable disposing the animation stops properly. Play again on-demand works. Play again (restarting) while it hasn’t ended yet works. So here I see everything I wanted except that it is tied to PD. And it even use the same Animation tab that loops like crazy without PD. That means this kind of behaviour is already kinda possible but not open for user yet. Is it just a step away to allow this?

On a related note, Animation via PD still has some annoyance. The Timeline tab behaviour that is always entering “Preview” mode whenever I click on a GO with PD should be able to turn off. Clicking on any object with PD and you cannot move it, because it is in Preview and all of your movement will be undone by the Timeline. So each click, you have to click the Preview button to get out of the mode. (Noted by position box turning light blue) I thought there should be an option in the top right little menu, but it isn’t there. The only way is to completely kill out the Timeline tab to stop it from stealing control (hiding as an inactive tab didn’t work, and this is even more annoying since it take me longer to figure out it is currently in preview by a hidden Timeline tab somewhere on the screen) but it is a hassle to kill it out and bring it back. I have to make an another dock preset just to have a version with Timeline and without it.

And also, this problem too : How to adjust the curve multiple vector elements/XYZ value together?

7 Likes

About a year later, I encountered this same issue and decided that I was not going to ignore this anymore, so I “fixed” it (only for Unity 2019).
The fix is close to 20 lines and includes a fix to another bug in that window.

5 Likes

Well, this is a nice workaround thank you for taking time to share with us. this kind of small things are what our life more bearable.

1 Like

Just a heads up for anyone who is looking for a solution, in Unity 2020, this code has

error CS1501: No overload for method ‘SamplePlayableGraph’ takes 4 arguments

So it would need some changes to be ported

A workaround I thought about is duplicating the last key and spacing it out.

1 Like

How is it still a problem in 2022 is beyond me.
Jesus christ, what really happened with Unity’s development? The marketing is advertising Cinemachine while the dev team can’t even make the animation preview play just once?

2 Likes

yeah seriously, is anyone working on this?

A year has passed, let’s bump it so Unity knows it still annoys people but my hopes are low as they rather work on making money than making their software usable.

3 Likes

hello Unity, it’s me in 2024, we still need this

3 Likes

After all these dramas and layoffs I doubt there is any developer left in Untiy. Just move on.

Duplicate the last key’s like 5 seconds away to , that will be good enough.

Bump. Should be native behaviour.