Class SpriteResolver
Updates a SpriteRenderer's Sprite reference on the Category and Label value it is set.
상속된 멤버
네임스페이스: UnityEngine.U2D.Animation
어셈블리: Unity.2D.Animation.Runtime.dll
구문
[ExecuteInEditMode]
[DisallowMultipleComponent]
[AddComponentMenu("2D Animation/Sprite Resolver")]
[Icon("Packages/com.unity.2d.animation/Editor/Assets/ComponentIcons/Animation.SpriteResolver.asset")]
[DefaultExecutionOrder(-20)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.2d.animation@latest/index.html?subfolder=/manual/SL-Resolver.html")]
[MovedFrom("UnityEngine.Experimental.U2D.Animation")]
public class SpriteResolver : MonoBehaviour, ISerializationCallbackReceiver
참고
By setting the SpriteResolver's Category and Label value, it will request for a Sprite from a SpriteLibrary Component the Sprite that is registered for the Category and Label. If a SpriteRenderer is present in the same GameObject, the SpriteResolver will update the SpriteRenderer's Sprite reference to the corresponding Sprite.
프로퍼티
spriteLibrary
Property to get the SpriteLibrary the SpriteResolver is resolving from.
선언
public SpriteLibrary spriteLibrary { get; }
프로퍼티 값
| 타입 | 설명 |
|---|---|
| SpriteLibrary |
메서드
GetCategory()
Get the Category set for the SpriteResolver.
선언
public string GetCategory()
반환
| 타입 | 설명 |
|---|---|
| string | The Category's name. |
GetLabel()
Get the Label set for the SpriteResolver.
선언
public string GetLabel()
반환
| 타입 | 설명 |
|---|---|
| string | The Label's name. |
OnPreviewUpdate()
Empty method. Implemented for the IPreviewable interface.
선언
public void OnPreviewUpdate()
ResolveSpriteToSpriteRenderer()
Set the Sprite in SpriteResolver to the SpriteRenderer component that is in the same GameObject.
선언
public bool ResolveSpriteToSpriteRenderer()
반환
| 타입 | 설명 |
|---|---|
| bool | True if it successfully resolved the Sprite. |
SetCategoryAndLabel(string, string)
Set the Category and label to use.
선언
public bool SetCategoryAndLabel(string category, string label)
파라미터
| 타입 | 이름 | 설명 |
|---|---|---|
| string | category | Category to use. |
| string | label | Label to use. |
반환
| 타입 | 설명 |
|---|---|
| bool | True if the Category and Label were successfully set. |
이벤트
onDeserializedCallback
Raised when object is deserialized in the Editor.
선언
public event Action onDeserializedCallback
이벤트 유형
| 타입 | 설명 |
|---|---|
| Action |