From c44eb3d89c0be39513a5f62f5127f76ef71d1932 Mon Sep 17 00:00:00 2001 From: bofeng-song Date: Wed, 13 Dec 2023 16:55:45 +0800 Subject: [PATCH] Fix setAnimation can not work normally at cache mode while animation's name different with default. (#16603) --- cocos/spine/skeleton.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cocos/spine/skeleton.ts b/cocos/spine/skeleton.ts index 8d8f0ec05ae..6821f129b73 100644 --- a/cocos/spine/skeleton.ts +++ b/cocos/spine/skeleton.ts @@ -897,6 +897,7 @@ export class Skeleton extends UIRenderer { let cache = this._skeletonCache.getAnimationCache(this._skeletonData!.uuid, name); if (!cache) { cache = this._skeletonCache.initAnimationCache(this.skeletonData!.uuid, this._skeletonData!, name); + cache?.setSkin(this._skinName); } if (cache) { this._animationName = name; @@ -996,6 +997,7 @@ export class Skeleton extends UIRenderer { this._animCache.setSkin(name); } } + this._skinName = name; this.invalidAnimationCache(); }