Search Unity

How to make animation preview plays only once?

Discussion in 'Animation' started by 5argon, Nov 20, 2018.

  1. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,265
    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.
     
    andreiagmu, Xarbrough and SugoiDev like this.
  2. NorthStar79

    NorthStar79

    Joined:
    May 8, 2015
    Posts:
    62
    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.
     
  3. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    518
    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.
     
    5argon likes this.
  4. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,265
    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 :

    ezgif-1-8efd5afd1132.gif 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 : https://forum.unity.com/threads/how...le-vector-elements-xyz-value-together.604474/
     
    Last edited: Jul 27, 2019