mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Minor cleanup for AnimationReferenceAsset.
This commit is contained in:
parent
861aa8d5c8
commit
496c3dd2ca
@ -34,13 +34,15 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
[CreateAssetMenu(menuName = "Spine/Animation Reference Asset")]
|
[CreateAssetMenu(menuName = "Spine/Animation Reference Asset")]
|
||||||
public class AnimationReferenceAsset : ScriptableObject {
|
public class AnimationReferenceAsset : ScriptableObject, IHasSkeletonDataAsset {
|
||||||
const bool QuietSkeletonData = true;
|
const bool QuietSkeletonData = true;
|
||||||
|
|
||||||
[SerializeField] protected SkeletonDataAsset skeletonDataAsset;
|
[SerializeField] protected SkeletonDataAsset skeletonDataAsset;
|
||||||
[SerializeField, SpineAnimation(dataField: "skeletonDataAsset")] protected string animationName;
|
[SerializeField, SpineAnimation] protected string animationName;
|
||||||
|
|
||||||
private Animation animation;
|
private Animation animation;
|
||||||
|
|
||||||
|
public SkeletonDataAsset SkeletonDataAsset { get { return skeletonDataAsset; } }
|
||||||
|
|
||||||
public Animation Animation {
|
public Animation Animation {
|
||||||
get {
|
get {
|
||||||
#if AUTOINIT_SPINEREFERENCE
|
#if AUTOINIT_SPINEREFERENCE
|
||||||
@ -51,7 +53,7 @@ namespace Spine.Unity {
|
|||||||
return animation;
|
return animation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize () {
|
public void Initialize () {
|
||||||
if (skeletonDataAsset == null) return;
|
if (skeletonDataAsset == null) return;
|
||||||
this.animation = skeletonDataAsset.GetSkeletonData(AnimationReferenceAsset.QuietSkeletonData).FindAnimation(animationName);
|
this.animation = skeletonDataAsset.GetSkeletonData(AnimationReferenceAsset.QuietSkeletonData).FindAnimation(animationName);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user