diff --git a/cocos/spine/attach-util.ts b/cocos/spine/attach-util.ts index 531ea355600..4915a218355 100644 --- a/cocos/spine/attach-util.ts +++ b/cocos/spine/attach-util.ts @@ -48,8 +48,7 @@ export class AttachUtil { init (skeletonComp: Skeleton): void { this._isInitialized = false; if (!skeletonComp || skeletonComp.socketNodes?.size === 0) return; - const isCached = skeletonComp.isAnimationCached(); - this._skeletonBones = isCached && skeletonComp._curFrame ? skeletonComp._curFrame.boneInfos : skeletonComp._skeleton.bones; + this._skeletonBones = skeletonComp._skeleton.bones; if (!this._skeletonBones || this._skeletonBones.length < 1) return; this._socketNodes = skeletonComp.socketNodes; if (!this._socketNodes || this._socketNodes.size <= 0) return; @@ -57,6 +56,10 @@ export class AttachUtil { this._syncAttachedNode(); } + updateSkeletonBones (bones: FrameBoneInfo[]): void { + this._skeletonBones = bones; + } + reset (): void { this._isInitialized = false; this._skeletonBones = null; diff --git a/cocos/spine/skeleton.ts b/cocos/spine/skeleton.ts index a8ae059d356..d4b1ad8ffd5 100644 --- a/cocos/spine/skeleton.ts +++ b/cocos/spine/skeleton.ts @@ -1051,6 +1051,9 @@ export class Skeleton extends UIRenderer { frameCache.updateToFrame(frameIdx); } this._curFrame = frames[frameIdx]; + if (this._curFrame !== undefined) { + this.attachUtil.updateSkeletonBones(this._curFrame.boneInfos); + } if (frameCache.isCompleted && frameIdx >= frames.length) { this._playCount++; if (this._playTimes > 0 && this._playCount >= this._playTimes) { diff --git a/platforms/native/engine/jsb-spine-skeleton.js b/platforms/native/engine/jsb-spine-skeleton.js index 10e1bacf9a6..5308b865eb6 100644 --- a/platforms/native/engine/jsb-spine-skeleton.js +++ b/platforms/native/engine/jsb-spine-skeleton.js @@ -844,6 +844,7 @@ const cacheManager = require('./jsb-cache-manager'); assembler.updateRenderData = function (comp) { comp._render(); + comp.syncAttachedNode(); }; // eslint-disable-next-line no-unused-vars