• Runtimes
  • code control issue

Related Discussions
...

I made a very simple spine file with 2 bones

Bone 1. I added some animation on it.

Bone 2. I have not add any key, and let it control at runtime, I call it "otherBone".

let bone = this.spineTestFile.skeleton.findBone("otherBone");
bone.scaleX = bone.scaleY = 2;
bone.y = -500;

like that, it works

However, when I play animation "otherBone" scale and position reset.

Anyway can fix this issue?

Animations are potentially overriding your previously set bone.scaleX every frame after they are applied. So you need to be sure to set your bone scale at the right time, after the animation has been applied. Please see your respective runtime documentation page, e.g. on spine-unity you can register your callback method at the skeleton.UpdateLocal event (see the docs page here, section SkeletonAnimation Update Callbacks) which will be called after each animation has been applied to local bone values but world bone values have not yet been computed.