Skip to content

Previewing

rmfandyplayz edited this page Oct 17, 2026 · 3 revisions

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. An animation's pop-out window has the same buttons for that one animation:

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 buttons call the player itself, the way your code would. An animation with no From plays from wherever things are, so once it has played, playing it again has nowhere left to go, and Reset only moves steps that have a From. Stop and Restore there puts everything back as it was when the player started up, so you can watch it again.

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. A preview started from an animation's pop-out window keeps running whatever you select. Closing the window stops and restores it.
  • While a value is being recorded, the preview belongs to the recording: Stop and Restore says to Finish or Cancel in its window instead.
  • Saving the scene mid-preview saves it at rest. The preview steps aside for the save, so the file gets every value as it was before you pressed Play (and each element's own material), then carries on exactly where it was.
  • 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.
  • A material step gives its Graphic a material instance while it previews, and the preview gives the Graphic its own material back when it ends. Before that was added, saving the scene after a material preview kept a copy of the instance inside the scene, cut off from the material asset.
  • Saving: on EditorSceneManager.sceneSaving (and PrefabStage.prefabSaving in prefab mode) for the previewed player's scene, the preview notes where every value stands, puts everything at rest and gives each Graphic its own material, and on sceneSaved puts it all back. That's done through the plain property setters, so it isn't an Undo step and the scene doesn't show as changed again straight after saving. TextMeshPro keeps its material copy in a saved field of its own (m_fontMaterial), which is swapped out too.
  • Play mode's Stop and Restore writes back the resting values the player captured when it initialised, the ones Baseline measures from. Game code has no equivalent; it's a testing aid.
  • 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.

Clone this wiki locally