Save and load locally in a Webgl Application
Asked Answered
W

3

0

Hi,

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

Wessel answered 18/7, 2023 at 16:31 Comment(0)
A
0

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

Alverson answered 18/7, 2023 at 17:25 Comment(0)
W
0

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

Wessel answered 18/7, 2023 at 17:42 Comment(0)
G
1

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.

Granado answered 21/7, 2023 at 14:55 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.