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.
상속된 멤버
네임스페이스: UnityEngine.U2D.Animation
어셈블리: Unity.2D.Animation.Runtime.dll
구문
[DisallowMultipleComponent]
[AddComponentMenu("2D Animation/Sprite Library")]
[Icon("Packages/com.unity.2d.animation/Editor/Assets/ComponentIcons/Animation.SpriteLibrary.asset")]
[MovedFrom("UnityEngine.Experimental.U2D.Animation")]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.2d.animation@latest/index.html?subfolder=/manual/SL-component.html")]
public class SpriteLibrary : MonoBehaviour
프로퍼티
spriteLibraryAsset
Get or Set the current SpriteLibraryAsset to use.
선언
public SpriteLibraryAsset spriteLibraryAsset { get; set; }
프로퍼티 값
| 타입 | 설명 |
|---|---|
| SpriteLibraryAsset |
메서드
AddOverride(Sprite, string, string)
Add or replace an override when querying for the given Category and Label.
선언
public void AddOverride(Sprite sprite, string category, string label)
파라미터
| 타입 | 이름 | 설명 |
|---|---|---|
| Sprite | sprite | Sprite to override to. |
| string | category | Category name to override. |
| string | label | Label name to override. |
AddOverride(SpriteLibraryAsset, string)
Add or replace an override when querying for the given Category. All the categories in the Category will be added.
선언
public void AddOverride(SpriteLibraryAsset spriteLib, string category)
파라미터
| 타입 | 이름 | 설명 |
|---|---|---|
| SpriteLibraryAsset | spriteLib | Sprite Library Asset to query. |
| string | category | Category name from the Sprite Library Asset to add override. |
AddOverride(SpriteLibraryAsset, string, string)
Add or replace an override when querying for the given Category and Label from a SpriteLibraryAsset.
선언
public void AddOverride(SpriteLibraryAsset spriteLib, string category, string label)
파라미터
| 타입 | 이름 | 설명 |
|---|---|---|
| SpriteLibraryAsset | spriteLib | Sprite Library Asset to query. |
| string | category | Category name from the Sprite Library Asset to add override. |
| string | label | Label name to add override. |
GetSprite(string, string)
Return the Sprite that is registered for the given Category and Label for the SpriteLibrary.
선언
public Sprite GetSprite(string category, string label)
파라미터
| 타입 | 이름 | 설명 |
|---|---|---|
| string | category | Category name. |
| string | label | Label name. |
반환
| 타입 | 설명 |
|---|---|
| Sprite | Sprite associated to the name and index. |
HasOverride(string, string)
Method to check if a Category and Label pair has an override.
선언
public bool HasOverride(string category, string label)
파라미터
| 타입 | 이름 | 설명 |
|---|---|---|
| string | category | Category name. |
| string | label | Label name. |
반환
| 타입 | 설명 |
|---|---|
| bool | True if override exist, false otherwise. |
OnPreviewUpdate()
Empty method. Implemented for the IPreviewable interface.
선언
public void OnPreviewUpdate()
RefreshSpriteResolvers()
Request SpriteResolver components that are in the same hierarchy to refresh.
선언
public void RefreshSpriteResolvers()
RemoveOverride(string)
Remove all Sprite Library override for a given category.
선언
public void RemoveOverride(string category)
파라미터
| 타입 | 이름 | 설명 |
|---|---|---|
| string | category | Category overrides to remove. |
RemoveOverride(string, string)
Remove Sprite Library override for a given category and label.
선언
public void RemoveOverride(string category, string label)
파라미터
| 타입 | 이름 | 설명 |
|---|---|---|
| string | category | Category to remove. |
| string | label | Label to remove. |