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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix: add error handlers for unhandled async WASM instantiation and scene loading
esenginee29c8e473fdc
diff --git a/sdk/src/playableRuntime.ts b/sdk/src/playableRuntime.tsindex b7b00ba86..601177179 100644--- a/sdk/src/playableRuntime.ts+++ b/sdk/src/playableRuntime.ts@@ -126,7 +126,9 @@ async function instantiateWasmModule(WebAssembly.instantiate(wasmBytes.buffer as ArrayBuffer, imports).then(r => cb((r as WebAssembly.WebAssemblyInstantiatedSource).instance,(r as WebAssembly.WebAssemblyInstantiatedSource).module),- );+ ).catch(e => {+ console.error('[Playable] WASM instantiation fallback failed:', e);+ });},);return {};@@ -134,6 +136,7 @@ async function instantiateWasmModule(};return await factory(opts);} catch (e) {+ console.error('[Playable] WASM module init failed:', e);return null;}}@@ -165,7 +168,9 @@ function buildSpineManager(WebAssembly.instantiate(wasmBytes.buffer as ArrayBuffer, imports).then(r => cb((r as WebAssembly.WebAssemblyInstantiatedSource).instance,(r as WebAssembly.WebAssemblyInstantiatedSource).module),- );+ ).catch(e => {+ console.error('[Playable] Spine WASM instantiation fallback failed:', e);+ });},);return {};diff --git a/sdk/src/preview/PreviewPlugin.ts b/sdk/src/preview/PreviewPlugin.tsindex 85298589f..20f02eb99 100644--- a/sdk/src/preview/PreviewPlugin.ts+++ b/sdk/src/preview/PreviewPlugin.ts@@ -46,7 +46,9 @@ export class PreviewPlugin implements Plugin {});manager.setInitial(PREVIEW_SCENE);- this.loadPromise_ = manager.load(PREVIEW_SCENE).then(() => {});+ this.loadPromise_ = manager.load(PREVIEW_SCENE).then(() => {}).catch(e => {+ console.error('[Preview] Failed to load preview scene:', e);+ });this.setupHotReload();}diff --git a/sdk/src/wechatRuntime.ts b/sdk/src/wechatRuntime.tsindex 15d0b43a0..9f4554529 100644--- a/sdk/src/wechatRuntime.ts+++ b/sdk/src/wechatRuntime.ts@@ -89,6 +89,8 @@ function createWasmInstantiator(wasmPath: string) {return (imports: WebAssembly.Imports, successCallback: Function) => {platformInstantiateWasm(wasmPath, imports).then((result) => {successCallback(result.instance, result.module);+ }).catch((e) => {+ console.error('[WeChat] WASM instantiation failed:', e);});return {};};