Repository navigation
Animation Sets
Copy and paste makes copies: retune the original and the forty copies stay as they were. When that gets tedious, put the animations in an Animation Set instead. It's one library of animations that any number of players use, so changing it changes them all.
This is optional. For anything only one object does, authoring straight onto the player is simpler.
Either create an empty one: in the Project window, Create → UI Animation → Animation Set. It's edited in its own Inspector, exactly like a player's animations.
Or turn an existing player's animations into one (usually easier). See below.
Then drag the set into a player's Shared Anim. Asset slot. That player can now play everything in it.
UI Animation Player
Use Unscaled Time ✔
Kill On Disable ✔
Shared Anim. Asset Menu Panels (UI Animation Set) ← the set
Animations 0 ← this player's own
Shared Animations (Menu Panels) 4 ← what the set adds, read-only
A set can't point at objects in a scene (Unity doesn't allow assets to), so the target slots are greyed out when you're editing a set. Use Target Paths instead: leave it empty for the player's own object, Icon for a child, .. for the parent. That's also exactly what makes an animation work on many different objects.
A player plays its own animations first, then everything from the set whose name it hasn't already used. So one panel can have its own Show while still using the set's Hide, Press and Attention.
This is shown everywhere it matters, so you don't spend ten minutes tuning a curve that never plays:
- overrides shared in grey, on the player's own animation
- overridden locally on the set's animation, under Shared Animations
- a note above the preview buttons
- a warning in the set's own Inspector, when its Preview On player overrides one
Under a player's own animations, Shared Animations lists everything its set adds, always up to date. Open one and it reads just like the player's own, but greyed out, since changes belong in the set. Two things there belong to this player:
On Complete On This Player. Each player can have its own On Complete for a shared animation: the same Show on every panel, and something different after it on each one. Press Add On Complete On This Player under the animation and fill it in like any event. Unlike the set's own On Complete, it can reach objects in this player's scene. It runs after the set's.
- Renaming the animation in the set keeps it connected.
- If the animation is deleted from the set, or the player's set is swapped, a note names the leftovers, with a Remove button.
Override. The button at the end of a shared animation's header copies it into this player's own animations, ready to edit. From then on this player plays its own copy, and its On Complete for it moves onto the copy. Other players aren't affected. Right-click offers the same, as Override Animation.
Steps here are checked against this player, so a shared step that won't work on this particular object shows its ⚠ here. The Scene gizmos follow what's open here too.
Author on one object first, then right-click its Animations list → Save as Animation Set…. Pick where to save, and it copies every animation on that player into a new set.
-
Dragged-in targets become Target Paths, so the set drives the same objects on any player with the same layout:
..for the button above anAnimationschild,../Iconfor its icon, empty for the player's own object. - A target that can't be reached by name (under a different root object, or with the same name as a sibling) can't become a working path. Its step will warn and do nothing rather than animate the wrong thing, and the Console lists each one.
- On Complete listeners on scene objects are left out, since a set can't hold them.
- The player itself isn't changed. Its own animations still win over the set's, so delete them once it uses the set.
- Saving over an existing set replaces its animations but keeps the asset, so every player already using it keeps working, including their own On Completes.
- After the first save, the menu also offers Save as Animation Set in '', which saves straight there without asking. It remembers the folder until Unity closes.
A set has nothing of its own to animate, so its Inspector borrows a player: drag one that uses the set into Preview On, and the Play / Reset buttons preview on it. Preview On is remembered until Unity restarts or recompiles, but isn't saved into the set.
- Changing a set while the game is running doesn't affect players that have already started. Each player takes its own copy when it starts. Likewise, assigning a set from code after the player has started does nothing.
- Copy/paste and mirroring work on a set just as on a player, so animations can move between the two.
- If two animations in one set share a name, the second can never play, and the set warns you.
- A step pasted into a set with a dragged-in target has it cleared, with a message saying so.
Under the hood
-
Why each player takes a copy: a step's resolved targets and the running sequence are stored on the animation. Two players reading one asset directly would animate each other's objects. So each player deep-copies the set's animations at
Awake(aJsonUtilityround-trip), pointing On Complete back at the original event. The field is calledSharedin code; renaming it would empty the slot on every player saved with one. - How a player's own On Complete stays connected through renames: each set animation gets a hidden Id the first time a player needs one, and the set is saved right then, so a scene can never point at an Id the set never saved. Copies never keep an Id: duplicating, pasting and mirroring clear it.
- The Shared Animations list draws a private, non-saved copy of the set, refreshed whenever the set changes, which is how it can show the set's data greyed out while still letting this player's own buttons work. Right-click Duplicate and Delete are removed there, since Unity's own versions would edit the set.
-
Save as Animation Set writes a target's path by going up with
..to the nearest shared parent, then down by name, and keeps it only if resolving it gives back exactly the original object. Otherwise the path is written from the scene root, which misses and warns. Saving over an existing set writes into it rather than recreating it, which would change its GUID and empty every slot pointing at it. - Preview On isn't saved because an asset can't hold a scene reference, which is the problem the whole feature works around.
Installation
Code API
Basic usage
Advanced usage
- Punch and Shake
- Sizing a RectTransform
- Movement Paths
- Sound
- Custom Property
- Material and Shader Properties
- Stylised Motion
- Interrupting and Chaining
- Mirroring
- Copy and Paste
- Animation Sets
- Scene Gizmos
Nitty-gritties
Warnings and Troubleshooting