Forum Multiplayer [SOLVED] WebGL PlayerIO not working on Unity 2021.2

Discussion and help relating to the PlayerIO Multiplayer API.

[SOLVED] WebGL PlayerIO not working on Unity 2021.2

Postby LorenzGames » February 9th, 2022, 4:01 am

With the new version of Unity, I get an error when Joining a room while playing on WebGL browser:

"The object returned from unityloader.instantiate() should be stored in a global variable on window somewhere. (e.g. window.gameinstance = unityloader.instantiate(...)"

This is probably because the webgl template for Unity has changed and it doesn't have window.gameinstance anymore.

Edit [SOLVED]: It can actually be fixed by adding a "then" in the HTML createUnityInstance =>

....).then((unityInstance) => {window.gameInstance = unityInstance;});
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Return to Multiplayer



cron