Forum Multiplayer WebGL PlayerIO issue in Unity 2021.2

Discussion and help relating to the PlayerIO Multiplayer API.

WebGL PlayerIO issue in Unity 2021.2

Postby tripknotix » April 14th, 2022, 7:08 pm

I keep getting this error whenever i try to call pioconnection.Send

example:
pioconnection.Send("Chat", "TestText");

result in browser developer console:
Not implemented: Class::FromIl2CppType
PlayerIOTest.framework.js.br:3 MethodAccessException: Attempt to access method 'PlayerIOClient.Connection.IMsgConnection.Send' on type '' failed.

this issue fails on both Chrome and Firefox.

I tried with the default PlayerIO SDK project as well, and its broken there too, if i follow all the steps all the way through i get the same error in the browser.
tripknotix
Paid Member
 
Posts: 28
Joined: March 12th, 2010, 11:00 am

Re: WebGL PlayerIO issue in Unity 2021.2

Postby tripknotix » April 14th, 2022, 8:26 pm

I divided up the processes that the default project goes through

i placed the CreateJoinRoom into its own function. and that appears to be where the error actually is. thats why we never have pioconnection assigned to.

This happens when we try to do client.Multiplayer.CreateJoinRoom(...)

in the browser this is the error that shows in a popup:
Error: The Object returned from Unityloader.instantiate() should be stored in a global variable on window somewhere. (e.g. window.gameIstance = Unity.instantiate(...)
tripknotix
Paid Member
 
Posts: 28
Joined: March 12th, 2010, 11:00 am

Re: WebGL PlayerIO issue in Unity 2021.2

Postby tripknotix » April 14th, 2022, 9:26 pm

So i've narrowed down the issue a little more.

in the function:
client.Multiplayer.CreateJoinRoom(...)

if i change:
delegate (Connection connection) {...}

to:
null

the error goes away but then i wont have a reference to the Connection connection.
tripknotix
Paid Member
 
Posts: 28
Joined: March 12th, 2010, 11:00 am

Re: WebGL PlayerIO issue in Unity 2021.2

Postby tripknotix » April 20th, 2022, 6:53 pm

so after all of that, it turns out it really is the issue that happens at the beginning when you try to run it in your browser.

your browser may have told you to add something similar to this code:
window.gameInstance = unityInstance;

this needs to go in this area described below:

createUnityInstance =>
...
}).then((unityInstance) => {
window.gameInstance = unityInstance;
...
});

this person solved it previously and posted on it on this forum:
viewtopic.php?f=4&t=36978
tripknotix
Paid Member
 
Posts: 28
Joined: March 12th, 2010, 11:00 am


Return to Multiplayer