Save and load locally in a Webgl Application


I am experimenting with Webgl applications and i can’t understand how to do create a simple functionality.

I would like to give the users the ability to save the data on their device, maybe chosing the filename or in which directory to save. And then of course then i would like the ability to load from file.

I do not mean to save to the persistenFilePath but to a file accessible in explorer in windows for example. And i have completely no idea on how to do so.

I see there are some assets for this in the asset store but they are not free and since I am just testing is too soon to buy something.

Can you help me maybe giving some simple example or standard practice? I m sure there must be a standard approach

did you try experimenting with PlayerPrefs? i personally haven’t tested it on WebGL, but I do think it works, as stated in the unity docs:

here is the link to the docs, if you’re interested: Unity - Scripting API: PlayerPrefs

Thanks but PlayerPrefs does not work for me. I would like to have multiple saves and with PlayerPref you can quickly run out of space

WebGl does not support saving locally because browsers restrict access to the file system. Everything in the system. io namespace cannot be used in a webgl build. You will have to find another system, like Unity Cloud Save, which is free to start.

1 Like