Hi everyone,
I’m facing an issue with Spine in CC 3.8.0. I tried to create a skeleton node at runtime and load SkeletonData from a resource. The node and sp.Skeleton component were successfully created, but it only shows a static image; the animation is not running.
Here is the code:
resources.load(‘animations/rambu’, sp.SkeletonData, (err, skeletonData) => {
if (err) {
error(err);
return;
}
const anims = Object.keys(skeletonData.getAnimsEnum()).filter(key => key !== ‘<None>’);
const skeletonNode = new Node();
skeletonNode.parent = this.node;
const skeleton = skeletonNode.addComponent(sp.Skeleton);
skeleton.skeletonData = skeletonData;
skeleton.animation = anims[0];
skeleton.premultipliedAlpha = false;
skeleton.loop = true;
});
and here is the result:
Tom_k
June 11, 2024, 9:20am
#2
Creator Version
Spine Support Version
v2.0.7 and below
v2.5
v2.0.8~v2.1
v3.6
v2.2
v3.7
v2.3 and above
v3.8
please make sure the spine version is compliance with the cocos Version.
You can try with change : move statement get anims to after granting parent for skeleton node.
I have already asked our animator, they are using Spine v3.8.99
I have already tried that, but it’s not working. There is no issue if I create a node manually using the editor, this issue only appears when creating a node (including instantiating a prefab) programmatically.