Sprite Swap Overview
Sprite Swap is a feature that enables you to change a GameObject’s rendered Sprite, but keep the same skeleton rig and Animation Clips. This enables you to quickly and easily create multiple characters that look different, but have the same animation rigs. You can also use Sprite Swap to switch the displayed Sprite on each frame at run time, to create frame-by-frame animation.
The workflow for implementing Sprite Swap differs if you are following the workflow integrated with 2D Animation, or if you are manually setting up your Sprites.
Below is the general workflow for implementing Sprite Swapping:
- Create and set up a Sprite Library Asset.
- Attach a Sprite Library component and Sprite Resolver component to the GameObject you want to use Sprite Swapping on. This GameObject must also contain a Sprite Renderer component.
The Sprite Library component contains the reference to a selected Sprite Library Asset, while the Sprite Resolver component is used to request a Sprite registered to that Sprite Library Asset by providing the Category and Label value of the desired Sprite.