Class SpriteLibrary
Component that holds a Sprite Library Asset. The component is used by SpriteResolver Component to query for Sprite based on Category and Index.
Implements
Inherited Members
Namespace: UnityEngine.U2D.Animation
Assembly: solution.dll
Syntax
[DisallowMultipleComponent]
[AddComponentMenu("2D Animation/Sprite Library")]
[Icon("Packages/com.unity.2d.animation/Editor/Assets/ComponentIcons/Animation.SpriteLibrary.png")]
[MovedFrom("UnityEngine.Experimental.U2D.Animation")]
[HelpURL("https://docs.unity.cn/Packages/com.unity.2d.animation@latest/index.html?subfolder=/manual/SL-component.html")]
public class SpriteLibrary : MonoBehaviour, IPreviewable
Properties
| Name | Description |
|---|---|
| spriteLibraryAsset | Get or Set the current SpriteLibraryAsset to use. |
Methods
| Name | Description |
|---|---|
| AddOverride(Sprite, string, string) | Add or replace an override when querying for the given Category and Label. |
| AddOverride(SpriteLibraryAsset, string) | Add or replace an override when querying for the given Category. All the categories in the Category will be added. |
| AddOverride(SpriteLibraryAsset, string, string) | Add or replace an override when querying for the given Category and Label from a SpriteLibraryAsset. |
| GetSprite(string, string) | Return the Sprite that is registered for the given Category and Label for the SpriteLibrary. |
| HasOverride(string, string) | Method to check if a Category and Label pair has an override. |
| OnPreviewUpdate() | Empty method. Implemented for the IPreviewable interface. |
| RefreshSpriteResolvers() | Request SpriteResolver components that are in the same hierarchy to refresh. |
| RemoveOverride(string) | Remove all Sprite Library override for a given category. |
| RemoveOverride(string, string) | Remove Sprite Library override for a given category and label. |