Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits)

I would have been very surprised if that works, and that has nothing to do with itch.io. For WebGL builds, Unity basically translates all scripts to web technology (javascript, WebGL, WASM). Many of the tools that are available in normal .NET such as file system, sockets, and probably mail too aren't available. And that's not even Unity's fault: some things simply don't exist in browsers, and other things are not allowed because of strict browser security rules. If you run your WebGL build locally on your own machine, you'll probably notice that it doesn't work there either.

However there are some things you can do instead:

From the Unity side, the easiest thing to do is using WebRequests:

https://docs.unity3d.com/Manual/webgl-networking.html

However this does require running a server that can process these requests, and that is configured correctly, which may be a hassle.

You could also combine your WebGL build with something like Google Analytics. This seems to be the best explanation I can find:

https://vediagames.com/blog/Simple-Google-Analytics-for-web-games?id=IkKE84awL0s...

Be careful with collecting analytics however, especially in Europe: with the recent very strict privacy laws, a lot of things may be considered illegal if you don't ask explicitly for user consent.