PO/Library/PackageCache/com.unity.2d.animation@5.0.7/Documentation~/SLASwap.md

2.3 KiB
Raw Blame History

Swapping Sprite Library Assets

If swapping each Sprite individually takes too much effort, you can instead swap the entire Sprite Library Asset to another one containing alternate Sprites.

The following example shows how to switch from a Sprite Library Asset of color Sprites to another one containing identical Sprites but in grayscale:


Left: Prefab with the colored Sprite Library Asset. Right: Prefab with the grayscale Sprite Library Asset.

  1. Create variants of your character artwork. In this example, a grayscale variant of the original artwork was created in Photoshop (or any other compatible image editor).

  2. Import both .psb files into the Unity Editor. Both become separate Prefabs in the Asset window.

  3. Select the color Prefab and open it in the Skinning Editor. Assign each Sprite of the character to a unique Category. It is suggested to name each Category and Label after the respective body part of the character. Apply the changes once you are ready, and exit the Sprite Editor.


    The Category and Label names for the color Prefab.

  4. Select the grayscale Prefab, and give its corresponding Sprites the same Category and Label names as the color Prefab.


    Give the same Category and Label names to the grayscale Prefab.

  5. Drag the color Prefab into the Scene view, and go to the root GameObject. The Sprite Library component is attached to the root GameObject and refers to the default Sprite Library Asset that Unity automatically generated.


    The color Sprite Library Asset.

  6. With the Inspector window the color Prefab remaining open, go to the Asset window and expand the grayscale Prefab. Find the grayscale Prefab Sprite Library Asset and drag it to the color Prefabs Sprite Library Asset box, which replaces the color Prefabs original Sprite Library Asset.

  7. The Sprites of the color Prefab should have switched to their grayscale counterparts of the grayscale Sprite Library Asset.


    The grayscale version of the color Sprite Library Asset.