Hitting 1MB PlayerPrefs limit on webgl

Discussion and help for Easy Save 3
Post Reply
mbmb
Posts: 4
Joined: Sun Sep 12, 2021 8:45 pm

Hitting 1MB PlayerPrefs limit on webgl

Post 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!
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hitting 1MB PlayerPrefs limit on webgl

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
mbmb
Posts: 4
Joined: Sun Sep 12, 2021 8:45 pm

Re: Hitting 1MB PlayerPrefs limit on webgl

Post 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,
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hitting 1MB PlayerPrefs limit on webgl

Post by Joel »

Hi there,

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

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
mbmb
Posts: 4
Joined: Sun Sep 12, 2021 8:45 pm

Re: Hitting 1MB PlayerPrefs limit on webgl

Post by mbmb »

I will try that again, just tried it but must not have set sync to file properly as it was still erroring.
mbmb
Posts: 4
Joined: Sun Sep 12, 2021 8:45 pm

Re: Hitting 1MB PlayerPrefs limit on webgl

Post by mbmb »

Setting location to cache and using saveraw and loadraw worked perfectly, thank you (and way faster than playerprefs performance-wise)!
Post Reply