Hello everyone :grinteeth:
I am very new to Spine (as a developer) and I hope my question isn't too stupid to begin witth :grinfake:
My use case, "how to set/update a skin on a SkeletonAnimation" is very simple, but I'd like to get a better undestanding on how to do things properly.
Let's say I have a running SkeletonAnimation, and want to set a skin on its skeleton.
My code is (skins being a List<Skin> deduced from the Skeleton's data) :
_skeleton.Skin = _skins[skinId];
[/b]
If I don't do anything else, the skin of the SkeletonAnimation displayed is not actually updated.
The skin is eventually updated after calling :
_skeleton.SetSlotsToSetupPose();
I am also noticing a little flickering on the Skeleton after this call, if I don't instantly follow with this method call :
_skeletonAnimation.Update(0);
[/b]
So my question is : why do I have to call
Skeleton.SetSlotsToSetupPose()
and
SkeletonAnimation.Update(float)
after (re)setting a skin ?[/b]
I'm not sure to understand why I need to reset the slots and the animation.
If it helps in any way, here's my initialization code :
private SkeletonAnimation _skeletonAnimation;
private Spine.AnimationState _spineAnimationState;
private Spine.Skeleton _skeleton;
private List<Skin> _skins = new List<Skin>();
void Start()
{
_skeletonAnimation = GetComponent<SkeletonAnimation>();
_spineAnimationState = _skeletonAnimation.AnimationState;
_skeleton = _skeletonAnimation.Skeleton;
_spineAnimationState.SetAnimation(0, idleAnimationName, true);
foreach (Skin skin in _skeleton.Data.Skins)
_skins.Add(skin);
}