mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 18:26:12 +08:00
[Unity] AnimationName warnings
https://github.com/EsotericSoftware/spine-runtimes/issues/444 This makes AnimationName getter and setter safer but still warns the user of unusual circumstances.
This commit is contained in:
parent
5378b7979e
commit
bb7d131c28
@ -72,6 +72,11 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
|
|||||||
|
|
||||||
public String AnimationName {
|
public String AnimationName {
|
||||||
get {
|
get {
|
||||||
|
if (!valid) {
|
||||||
|
Debug.LogWarning("You tried access AnimationName but the SkeletonAnimation was not valid. Try checking your Skeleton Data for errors.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
TrackEntry entry = state.GetCurrent(0);
|
TrackEntry entry = state.GetCurrent(0);
|
||||||
return entry == null ? null : entry.Animation.Name;
|
return entry == null ? null : entry.Animation.Name;
|
||||||
}
|
}
|
||||||
@ -79,6 +84,12 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
|
|||||||
if (_animationName == value)
|
if (_animationName == value)
|
||||||
return;
|
return;
|
||||||
_animationName = value;
|
_animationName = value;
|
||||||
|
|
||||||
|
if (!valid) {
|
||||||
|
Debug.LogWarning("You tried to change AnimationName but the SkeletonAnimation was not valid. Try checking your Skeleton Data for errors.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (value == null || value.Length == 0)
|
if (value == null || value.Length == 0)
|
||||||
state.ClearTrack(0);
|
state.ClearTrack(0);
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user