Sprite Animation Swapper is a tool to quickly change spritesheets for your animations in the Unity® Game Engine.
Sprite Animation Swapper can automatically replace sprites used in your animations to create new variants of your animations, animator controllers and prefabs.
Supports all Unity versions since Unity 2019.4.
Latest version: 1.0.0
What is Sprite Animation Swapper?
Sprite Animation Swapper is an editor extension for the Unity® Game Engine.
You have a lot of 2D characters and want to reuse your animations with their own spritesheets? Instead of manually updating your animations, sprite by sprite, let Sprite Animation Swapper handle this task for you, fast!
Sprite Animation Swapper can automatically find matching sprites in a spritesheet, either by name or index of the individual sprite that’s used in your animations. If you use the same spritesheet layout for your characters, this’ll be a one-click update for all animations of a character.
You can either update your existing animations, or create a new copy of the animation (including new animator override controller and prefab using those animations).
Changing Sprites
Drag and drop the assets you want to use into the editor and hit the Auto Replace button – that’s all. But no worries, changes are only made if you save them. The editor will list all animations with their keyframes and the changes that’ll be made. You can also manually adjust the used sprites or use a specific spritesheet for an animation’s auto replacement.
The project tab’s context menu can be used to quickly open/add assets in the editor or auto replace sprites in one go – you only need to save the changes.
If your animations came from a prefab, the prefab’s sprite renderers can also be updated with new sprites.
Changing the Binding
You’ve changed the setup of your prefab or want to reuse an animation on a prefab where the Sprite Renderer is on a different child object?
Sprite Animation Swapper allows you to change the binding of a sprite animation. If the animation was added using a prefab, all available Sprite Renderers of the prefab are available in a popup field. Otherwise, not coming from a prefab, you can freely define the path to the Sprite Renderer in a text field.
Saving
Once you’re fine with your changes, you can either save it directly on the existing assets, or create new copies for the changed versions.
Saving as copies will automatically create a new prefab, animator override controller and animations for you, ready to go.
Please Note
Sprite Animation Swapper is only for editing or copying existing animations in the editor. Changing sprites in animations at runtime is not supported. Also, sprite animations are only supported by Mecanim animations.
Documentation
After purchase, import Sprite Animation Swapper into your project using the Unity Package Manager.
The Editor
Open the editor using the Unity menu: Window > Animation > Sprite Animation Swapper
You can also use the context menu in Unity’s Project tab to directly open/add selected assets: Sprite Animation Swapper > Open Asset/Add Asset
The editor is split into 3 areas:
– settings for replacmenet and saving
– animation list (containing all added animations)
– sprite list (containing all added sprites that are used for auto replacement)
Settings
The settings area list all available settings for asset import, auto replacement and saving.
- Default Foldout State
If enabled, animations and spritesheets added to the editor will have their foldout expanded. - Log Output
Optionally output replacement and saving operations to the Unity console.
This’ll give you details on which keyframes where replaced, if a copy of an animation was created, etc.
The Sprite Replacement settings are used by the auto replacement and quick replacement operations.
- Replacement Mode
Either replace sprites by matching Name or Index of the sprites.
See the details for sprite replacement below. - Skip Defined Overrides
If enabled, auto replacement will not replace the sprite of a keyframe that already has a sprite defined as replacement. - Auto Replace
Click on the button to automatially replace the sprites in all added animations.
The Save Changes settings are used to save the changes you made to your animations. Changes are not saved automatically.
- Save As Copy
If enabled, any animation with a sprite change will be saved as a new copy of the existing animation.
When added from an animator controller or prefab, this’ll also create new variants for them.
Saving as copy requires to add a prefix and/or postfix to the asset names. - Copy Prefix
Only available when using Save As Copy.
Text added in front of the name of the copied asset. - Copy Postfix
Only available when using Save As Copy.
Text added after the name of the copied asset. - Save Changes
Click on the button to save the changes of your animations.
Animation List
The animation list shows all added animations.
When animations where added from an animator controller or prefab, all animations of that animator controller/prefab will be listed below them, grouping them together. The sprites of the prefab (from Sprite Renderer components) will also be listed and are changed by auto replace operations (and can be manually changed).
The buttons at the top of the animation list allow you to perform some list operations:
- Clear List
Removes all added animations. - Reset All
Resets all sprite replacements of the added animations, i.e. recreating the original animation. - Close All
Closes all foldouts of the animations. - Open All
Opens all foldouts of the animations.
The search field allows you to filter the list, only displaying animations with a matching name.
Individual animations will show the animation clip asset they belong to, as well as the path of the sprite within it’s prefab. If your animation handles multiple sprites on different child objects, they’ll all list their keyframes for their individual paths.
You can also perform operations on the individual animations.
- Remove
Removes this animation from the list. - Auto Replace
Only uses auto replace for this animation. - Reset
Only resets this animation to it’s original state. - Path (Sprite Renderer)
The path to the child object the animation’s Sprite Renderer is bound to.
You can change the path, i.e. rebind the animation to a different child object (or the root of the prefab).
If the animation was added from a prefab, this setting is a popup field with all available sprite renderers.
If the animation was added on it’s own or from an animator controller (without a prefab), this setting is a text field to manually input the path. In this case, the root of the prefab is omitted, child objects are separated by a ‘/’, e.g.: Child1/Child2 - Quick Replace
Select a spritesheet (texture) that will be used for quick replacement.
If one is selected, a Use button will be visible beside it – click it to auto replace the animation’s sprites using the defind spritesheet.
The animation lists the sprite keyframes of the animation, showing the current sprite on the left side and the replacement/override on the right side. You can drag and drop a sprite on any of them to set a replacement.
Sprite List
The sprite list shows all added spritesheets (textures) with their individual sprites. Only sprites added here will be used for auto replacement.
The buttons at the top of the sprite list allow you to perform some list operations:
- Clear List
Removes all added spritesheets. - Close All
Closes all foldouts of the spritesheets. - Open All
Opens all foldouts of the spritesheets.
An individual spritesheet will show it’s Texture (Source) at the top, followed by the sprites of the spritesheet. You can drag and drop the sprites from their display fields onto keyframe sprites in the animation list.
Adding Assets
Add animations and sprites either by drag and drop or using the context menu in the Unity project tab.
Animations can be added from:
- animation clip assets
- animator controller and animator override controller assets
- prefabs (via an Animator component using an animator controller)
Sprites are added from their parent texture asset, i.e. they’re added as complete spritesheets.
When adding a whole folder, all animation clips, animator controllers, prefabs and textures/sprites within the folder (and it’s sub-folders) will be added.
Drag and Drop
Drag and drop any asset or folder on one of the areas marked as Drop Folders/Assets Here.
Context Menu
Using the context menu in the project tab allows you to directly open the editor and add assets to it.
- Open Assets
Opens the editor and adds the assets.
If the editor is already open, the previously added animations and sprites will be removed before adding new assets. - Add Assets
Opens the editor and adds the assets.
If the editor is already open, only adds the new assets. - Open and Auto Replace by Name
Same as Open Assets, immediately using auto replace (replacement mode Name). - Open and Auto Replace by Index
Same as Open Assets, immediately using auto replace (replacement mode Index).
Changing Sprites
Sprites can be changed in 3 ways:
- auto replacement
- quick replace in an individual animation with a defined spritesheet
- manual replacement by drag and drop
Auto Replace
Auto replacement will automatically replace the animation’s sprites by found matching sprites. Matching sprites can be found by Name or Index, depending on the Replacement Mode setting. If the animation was added using a prefab, the prefab’s sprites will also be changed by matching sprites.
Matching by Name will first check all added spritesheets for matching parent texture name and sprite name. If none is found, only matching sprite name (in all spritesheets) is used.
E.g.: A keyframe uses the sprite named Walk_1 from the texture Walk. Auto replacement will now search the added spritesheets for a texture named Walk and a sprite Walk_1 within it. If none is found, it’ll search all spritesheets looking for a sprite named Walk_1.
Matching by Index will check for matching parent texture name and same index of the sprite sub-asset as it’s currently used in the animation.
E.g. a keyframe uses the sprite at index 1 from the texture Walk. Auto replacement will now search the added spritesheets for a texture named Walk and use it’s sprite at index 1.
Quick Replace
Quick replacement allows replacing the sprites of a single animation with a defined spritesheet. The sprites are found by matching sprite name or sprite index, depending on the Replacement Mode setting (i.e. same as in Auto Replace).
Select a texture (spritesheet) in the Quick Replace setting of an animation and click on the Use button.
Manual Replace
Manual replacement is simply dragging a sprite (either from the sprite list or anywhere in your Unity project) on a keyframe’s sprite.
Changing the Binding
An animation is bound to a specific Sprite Renderer of the game object it was created on.
Sprite Animation Swapper allows you to change this path binding using the Path (Sprite Renderer) setting of the listed animations. The path is relative to where the Animator component using the animation is on the prefab.
From Prefab
If the animation was added to the editor via a prefab, this setting is a popup field with all sprite renderers that where found on the prefab.
The available paths will be displayed from the prefab’s root (including the root’s name). The actual binding path that’ll be used is relative to the Animator component on the prefab – e.g. if it’s on a child object, only sprite renderers on that child object and it’s child objects are available.
From Animation
If the animation was added on it’s own or coming from an animator controller (i.e. without a prefab), this setting is a text field where you can manually input a path.
In this case, the name of the root game object is omited, separate child objects are divided by a ‘/’ sign, e.g.: Child1/Child2
The path must be defined coming from the Animator component using the animation. If the component is placed on a child object, the path has to be defined from that child object as root.
Saving
Changes to the animations are not automatically saved. Click on the Save Changes button to save whatever changes you made. Only animations that contain any changes will be saved.
Saving changes to the existing animations can be undone using Unity’s undo/redo functionality.
Saving As Copy
When enabling Save As Copy, a new copy of the animation is created with the changes, leaving the original animation as it was.
Saving as copy requires to adding a prefix and/or postfix to the name of the copied assets, using the Copy Prefix and Copy Postfix settings.
If the animation was added from an animator controller, a new animator override controller will be created, using the copied animations as overrides.
If the animation was added from a prefab, a new copy of the prefab is created, using a new animator override controller (that will be created) using the copied animations as overrides.
Creating new copies of assets can not be undone.