From 141ab88bbf2e3e73e149c19b184e5d3f801017e3 Mon Sep 17 00:00:00 2001 From: Natalie Date: Mon, 2 Dec 2024 15:45:12 +1300 Subject: [PATCH] [DX-3465] feat: new game bridge callback function for unity windows (#2438) --- packages/game-bridge/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/game-bridge/src/index.ts b/packages/game-bridge/src/index.ts index c3878890ac..b57395ea12 100644 --- a/packages/game-bridge/src/index.ts +++ b/packages/game-bridge/src/index.ts @@ -78,6 +78,7 @@ declare global { ue: any; // eslint-disable-next-line @typescript-eslint/naming-convention Unity: any; + uwb: any; } } @@ -136,8 +137,10 @@ const callbackToGame = (data: CallbackData) => { blu_event('sendtogame', message); } else if (typeof UnityPostMessage !== 'undefined') { UnityPostMessage(message); - } else if (window.Unity !== 'undefined') { + } else if (typeof window.Unity !== 'undefined') { window.Unity.call(message); + } else if (typeof window.uwb !== 'undefined') { + window.uwb.ExecuteJsMethod('callback', message); } else { const gameBridgeError = 'No available game callbacks to call from ImmutableSDK game-bridge'; console.error(gameBridgeError);