Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(spine): setSkeletonColor degrades gracefully when the wasm lacks it

esengine1595ccfb2f2e
diff --git a/sdk/src/spine/SpineController.ts b/sdk/src/spine/SpineController.ts
index ad9a781f6..40b6512ef 100644
--- a/sdk/src/spine/SpineController.ts
+++ b/sdk/src/spine/SpineController.ts
@@ -312,9 +312,11 @@ export class SpineModuleController {
return !!this.api_.setSlotColor(instanceId, slotName, r, g, b, a);
}
- /** Whole-skeleton tint, multiplied into every vertex — backs SpineAnimation.color. */
+ /** Whole-skeleton tint, multiplied into every vertex — backs SpineAnimation.color.
+ * Optional-chained: a spine wasm without this export (a realm still on an older
+ * module — the SDK can lead the wasm) degrades to a no-op instead of crashing. */
setSkeletonColor(instanceId: number, r: number, g: number, b: number, a: number): boolean {
- return !!this.api_.setSkeletonColor(instanceId, r, g, b, a);
+ return !!this.api_.setSkeletonColor?.(instanceId, r, g, b, a);
}
// =========================================================================