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

2.3 KiB
Raw Blame History

Sprite Swap manual setup

When a Category or Label is created from the Sprite Visibility panel in the Skinning Editor, Unity automatically generates a Sprite Library Asset as a sub-Asset of the character Prefab that contains the Categories and Labels created for that Prefab.

You can create a Sprite Library Asset manually and choose which GameObject refers to it, by following the steps below:

  1. Select the Sprite Library Asset from the Asset creation menu by going to: Asset > Create > Sprite Library Asset.

  2. Select the new Sprite Library Asset and go to its Inspector window. The list of Categories and Labels available in the Asset is displayed.

  3. Select Add (+) at the bottom-right of the List to add a new Category. Enter a name into the New Category box. Each Category in the same Sprite Library Asset must have a name unique from others.

  4. Next, create an empty GameObject (menu: Right-click on the Hierarchy window > Create Empty). Select it and then add the Sprite Renderer component to it.

  5. Add the Sprite Library component to the same GameObject. Assign the Sprite Library Asset created in step 3 to the Sprite Library Asset box.

  6. Add the Sprite Resolver component to the same GameObject.

    Open the Category drop-down menu, and select a Category you created in step 3. The component will then display a Label drop-down menu and a Visual Variant Selector that displays thumbnails of the different Sprites available in the Category.

  7. When you select a Sprite in the Sprite Resolver component, Unity automatically replaces the current Sprite in the Sprite Renderer component with the one you have selected.