Sprite Library Asset
The Sprite Library Asset contains the Categories and Labels that a character Prefab refers to to determine what Sprites are rendered. This allows you to group similar or interchangeable Sprites together that can be used for Sprite Swapping.
Unity automatically generates a Sprite Library Asset as a sub-Asset of the Prefab when you create any Categories or Labels while editing the character Prefab. To manually create a Sprite Library Asset, go to Assets > Create > Sprite Library Asset.
Inspector view of Sprite Library Asset
Select Add (+) at the bottom-right of the Sprite Library Asset to add a new Category. Select Remove (-) to remove a Category instead.
Property | Function |
---|---|
Category Name | Enter a Category name. Category names must be unique. |
Category List | Use these settings to define the number of Sprites you want to include, and the label for each Sprite. |
Size | Enter the number of Labels you want to assign to this Category. |
Label | Enter a name for the registered Sprite. This Label must be unique from other Labels in the same Category. |
Sprite | Select or drag a Sprite onto this box to register it as the Sprite reference for this Label. |
Sprite Library component
The Sprite Library component is attached to the root GameObject of the character Prefab. Assign your preferred Sprite Library Asset to the Sprite Library Asset box that the Sprite Renderers of the GameObjects within the Prefab will refer to and render respectively.
Inspector view of Sprite Component
Property | Function |
---|---|
Sprite Library Asset | Set this to the Sprite Library Asset you want to use for this charcter Prefab. |
Sprite Resolver component
The Sprite Resolver component is attached to each GameObject in the Prefab. The component pulls information from the Sprite Library Asset (assigned to the Sprite Library component at the root of the Prefab). The component contains two properties - Category and Label - and a visual Variant Selector that displays thumbnails of the Sprites contained in the Sprite Library Asset.
Inspector view of Sprite Resolver Component, with the variant visual selector.
Property | Function |
---|---|
Category | Select which Category you want to use a Sprite from for this GameObject. |
Label | Select the Label of the Sprite you want to use for this GameObject. |
Select the Sprite you want the Sprite Renderer to render by selecting from the Category and Label dropdown menus, or select the Sprite directly in the visual Variant Selector.
Sprite Skin component
When the character Prefab is brought into the Scene view, the PSD Importer automatically adds the Sprite Skin component to any Sprite that have any bone influences.