2.3 KiB
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:
-
Select the Sprite Library Asset from the Asset creation menu by going to: Asset > Create > Sprite Library Asset.
-
Select the new Sprite Library Asset and go to its Inspector window. The list of Categories and Labels available in the Asset is displayed.
-
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.
-
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.
-
Add the Sprite Library component to the same GameObject. Assign the Sprite Library Asset created in step 3 to the Sprite Library Asset box.
-
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.
-
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.