Page 1 of 1

Hitting 1MB PlayerPrefs limit on webgl

Posted: Sun Sep 12, 2021 8:52 pm
by mbmb
Hi all,


For my application, I can't use the ES3Cloud code directly (no mysql on the server), but even when testing with that, I'm running into the 1MB PlayerPrefs limit on webplayer: I have my ES3 file contents in a string in the player and am asking how I feed that into a non-filesystem-backed ES3File (or elsewhere) to be able to do ES3.Load's... for all my objects without having to worry about the 1MB limit?

I searched the forum, docs, and tutorials for a while and tried a bunch of stuff to get this to work with no luck so far, any help is much appreciated!

Re: Hitting 1MB PlayerPrefs limit on webgl

Posted: Sun Sep 12, 2021 9:38 pm
by Joel
Hi there,

I don't believe PlayerPrefs is limited to 1MB on WebGL (this was only the case in the Unity Web Player).

If you want to store data in RAM rather than on disk, you should use the Cache (this is documented here). You can then use ES3.LoadRawString to get the data from the cache as a string.

All the best,
Joel

Re: Hitting 1MB PlayerPrefs limit on webgl

Posted: Sun Sep 12, 2021 9:53 pm
by mbmb
I’m getting the playerprefs memory exception in all the browsers I’ve tried, so very happy to try the cache:

I’m good with using the cache object once it’s populated, but how do I populate the cache from a string (Json contents of the ES3 save-file)

Thanks for the fast response!

Regards,

Re: Hitting 1MB PlayerPrefs limit on webgl

Posted: Sun Sep 12, 2021 10:14 pm
by Joel
Hi there,

You do this using ES3.SaveRaw with the Cache save location enabled.

All the best,
Joel

Re: Hitting 1MB PlayerPrefs limit on webgl

Posted: Sun Sep 12, 2021 10:27 pm
by mbmb
I will try that again, just tried it but must not have set sync to file properly as it was still erroring.

Re: Hitting 1MB PlayerPrefs limit on webgl

Posted: Sun Sep 12, 2021 11:21 pm
by mbmb
Setting location to cache and using saveraw and loadraw worked perfectly, thank you (and way faster than playerprefs performance-wise)!