Closed saulrecon closed 3 years ago
@saulrecon Yep. Thanks for the reminder. I'll take a look and see what needs to be updated. 👍
...and now 2.3.2. >_< +1
Any updates on this yet? I'm hoping to use this as part of a larger prototype for a new game type and would love to be able to leverage the built-in functionality in this demo game.
Hey @saulrecon. I definitely don't want to limit your chance to leverage this code to prototype. We're a bit swamped with the lead up to Christmas. Lots of game studios want to get their games ready for the Christmas season/launch.
We'll handle it in the new year or happy to give advice on how to approach the upgrade if you want.
Hi everyone, we're also interested in using Nakama + WebGL for some of our projects. @novabyte I can take a stab at doing the upgrade, some advice would surely be helpful!
I've started with making an HTML5 compile and running the app via serve on node.js.
On start I get the error:
Counldn't connect to Nakama server; message: System.TypeInitializationException: The type initializer for 'System.Threading.Timer' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Threading.Timer.Scheduler' threw an exception. ---> System.SystemException: Thread creation failed. UnityLoader.js:4 at System.Threading.Thread.StartInternal (System.Security.Principal.IPrincipal principal, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0
and when clicking a retry, I get the following:
Counldn't connect to Nakama server; message: System.ArgumentNullException: Value cannot be null. UnityLoader.js:4 Parameter name: obj UnityLoader.js:4 at System.Threading.Monitor.ReliableEnterTimeout (System.Object obj, System.Int32 timeout, System.Boolean& lockTaken) [0x00000] in <00000000000000000000000000000000>:0
Attaching screenshot of the console below:
@polats It looks like the code uses timer tasks in a few places which won't work in WebGL because Unity doesn't know how to convert it to a window.setTimeout
call. I think the best approach will be to just remove those code paths.
Our studio is looking to do the same thing. Is it possible to merge in the pull request, then those of us migrating this could add more after that?
I'll try and do a PR once I have a clean fix. I've had some initial success and was able to login to Nakama by using the Nakama 2.2 update by @ArisTsevrenis https://github.com/heroiclabs/unity-sampleproject/pull/4
From that update I had to initialize the Nakama Client with UnityWebRequestAdapter as discussed here: https://github.com/heroiclabs/nakama-unity#unity-webgl
Then I had to create a different way to get a device id (NakamaSessionManager.cs) since SystemInfo.deviceUniqueIdentifier doesn't work on WebGL.
I'm still running into some of the Timer Task issues when changing the user name, will continue investingating:
@Godatplay I have an in-progress build forked here: https://github.com/polats/unity-sampleproject/tree/webgl-fix-11-22-2019
The build runs the updated Nakama version from https://github.com/heroiclabs/nakama-unity (2.4.0-dev), and should properly compile and run as a webGL executable.
Some issues remaining though:
Not sure if we should do a pull-request because of the above issues.
We've completed a code refresh of this project which updates it to the latest client SDK.
Is it possible to update the sample project to include compatibility with Nakama (latest is 2.3.1) as well as support WebGL? I did notice a pull request with what seems to be the necessary updates (not WebGL though, I think), although there are some initial bugs with it as is. Thanks!!