Previewing - rmfandyplayz/UnityUIAnimationTools GitHub Wiki

You can watch your animations without entering play mode. Under each player's animations are buttons for every animation it has, including ones from its Animation Set:

Button Does
Play Plays the animation on the real objects in your scene
Reset Jumps to the animation's first frame without playing it. Steps with a From jump to it, the rest stay put
Stop and Restore Ends the preview and puts everything back exactly as it was before you pressed Play

Every button has a tooltip. In play mode, the same buttons just play the animation for real.

Previews carry on from each other

Play Open, then Close, and the Close starts from where the Open finished. That's the only way to judge a closing animation, since its whole job is to start from the open state.

  • If the first one is still playing when you press the second, it's finished off first. So where the second starts never depends on when you clicked.
  • Pressing Play on the same animation again replays it from where it started last time, so you can keep tweaking one animation and replaying it.
  • Stop and Restore goes all the way back to the resting state.

Edits you make in the Inspector between two Plays are picked up by the second one.

It's safe

The preview moves your real scene objects, so it's careful about it:

  • Everything is put back when the preview ends, including a shake stopped half way.
  • The whole preview is one Undo step. Ctrl+Z is the escape hatch if anything looks wrong.
  • Sounds don't play, and On Complete events don't fire. An On Complete is wired to game code, which shouldn't run outside play mode.
  • It ends by itself (restoring first) when you select something unrelated, enter play mode, or scripts recompile. Selecting one of the objects being animated doesn't end it, so you can pose things for the record button.
  • Only one player previews at a time. Previewing another one ends the current preview first.

Two differences from play mode

  1. Every preview Play starts from the animation's first frame, exactly like Reset then Play. In the game, an animation with Apply From Values Immediately off leaves its delayed steps alone until their turn. So a Close played from rest might look broken in the game, when it's only ever meant to play after its Open.
  2. Pressing a different animation while one is running always finishes the running one first in the preview. In the game, that's up to Interrupt Others: COMPLETE behaves like the preview, and STOP stops the running one where it is. See Interrupting and Chaining.

If either matters for what you're making, check it in play mode.

Scene Gizmos

The Scene Gizmos button under the preview controls the drawings of your animations in the Scene view. See Scene Gizmos.

Under the hood
  • Values are captured per property before the first Play, and restored the same way. It never round-trips whole components, which would also rewrite things like an Image's sprite.
  • Resting values are re-captured before every Play, from the true resting state, so Baseline endpoints never drift however many animations you chain.
  • The preview also ends itself on entering play mode before Unity backs the scene up. Otherwise an unrestored preview would come back out of play mode looking like authored data.
  • Every preview sequence is tagged and killed with DOTween.Kill(id), because outside play mode an ordinary tween.Kill() does nothing (DOTween never initialises in edit mode). See Under the Hood.
  • The shared audio source doesn't exist outside play mode at all, as a second guard against sounds.
⚠️ **GitHub.com Fallback** ⚠️