Dino0040 / Leaderboards

MIT License
5 stars 0 forks source link

Error on sending score in Unity 2020 IL2CPP (WebGL) #1

Closed DeltriDev closed 10 months ago

DeltriDev commented 10 months ago

I am making a game with the exploitavoid leaderboards. Both the async and coroutine versions work on the editor and the windows build, but won't send scores on the webgl build. The leaderboards can be fetched in the web build just it fails to send the score. I am using unity 2020.31.1f and I'm also sending a screenshot of the error image

Dino0040 commented 10 months ago

We seem to have stumbled upon an old unity bug here.

During IL2CPP compilation (only happens for web builds by default) unity tries to remove any unused code from the project, presumably to reduce the binary size. In this case, some methods that are needed for the JSON serializer are stripped out of the final binary, with any attempt at accessing them crashing the application. I was able to compile a working example in 2020.3.31f1 by instructing unity to not strip any code in the System.Runtime.Serialization namespace.

Can you create a "link.xml" in your project's "Assets" folder with the following content and make a new webgl build? I would appreciate it if you report back your results.

`

`

DeltriDev commented 10 months ago

Well, I was planning to install a new unity version, but I will try this before to at least see that it works. I will report back with any results, thanks.

DeltriDev commented 10 months ago

Ok, it works! Thank you very much!