Just to document this somewhere
SkeletonAnimation
[SerializeField]
private String _animationName;
public String AnimationName {
get {
TrackEntry entry = state.GetCurrent(0);
return entry == null ? null : entry.Animation.Name;
}
set {
if (_animationName == value) return;
_animationName = value;
if (value == null || value.Length == 0)
state.ClearTrack(0);
else
state.SetAnimation(0, value, loop);
}
}
Skeleton Animation uses the AnimationName get/set to effect Track 0, and during set it updates the _animationName variable.
If an outside script uses state.SetAnimation(0, animName, loop) then _animationName is never set.
The SkeletonAnimationInspector does all its stuff by reading that value.
Proposed fix is to patch SkeletonAnimationInspector to detect any differences in Track 0 from the state of the serialized SkeletonAnimation properties at the top of the gui call to prevent overriding of whatever was in Track 0. No point in doing this at edit time as SetAnimation should generally only be called during gameplay from external code anyway.
if(Application.isPlaying){
TrackEntry currentState = component.state.GetCurrent(0);
if(currentState != null){
if(component.AnimationName != animationName.stringValue){
animationName.stringValue = currentState.Animation.Name;
}
if(loop.boolValue != currentState.Loop){
loop.boolValue = currentState.Loop;
}
if(timeScale.floatValue != currentState.TimeScale){
timeScale.floatValue = currentState.TimeScale;
}
}
}