Firefox Itch.io PlayerPrefs issue

Hey,

So I’m building a small test game to try out WebGL and it’s behaving differently in Chrome and Firefox when I upload it to itch.io.

In Firefox it doesn’t save PlayerPrefs but it does in Chrome. However in Chrome the up and down arrow keys will always scroll as well as control the game (though I’m not too bothered about that, my game has alternate controls). I’ve tested it in Firefox on a friend’s laptop and got the same ‘PlayerPrefs will not be saved’ message.

When I just open the index.html file in Firefox it does save PlayerPrefs.

Any ideas why this would be happening? It’s a development build if that changes anything.

Here’s a link to the game on itch.io: Temples by Dziek

Cheers for reading.

Seems to be similar to this issue : http://forum.unity3d.com/threads/playerprefs-will-not-be-saved.319348/

Can you try a local version of the game (e.g: run it locally to see if PlayerPrefs are working)

In Firefox it does save locally, so it must be the same problem - I just thought that would have been a problem in all browsers.

In that thread you mention using localStorage instead. I’ve been looking into but don’t know where to start (all this html stuff is new to me).

I found this link, but don’t know how to work it into my Unity project: HTML Web Storage API

Could you maybe point me in the right direction?

I haven’t actually done any of that myself, so I’m afraid I can’t really assist you there.

I guess you’re free to implement you’re own serialization layer in JS, probably worth checking for an existing library or solution for doing that, only adding the appropriate Unity “hooks” to call into that.

Despite my fears of HTML it was all rather easy!

So if anyone else is stuck these two links should see you through:

1 Like