How to save in WebGL builds?

Note: The asset uses a deprecated method to make the WebGL save work. It has been tested in the version asset was developed in (2020.3.x), but may not work in higher versions.

TL:DR;

There is no additional setup on your end to use web saves, it will automatically use it if your game is in a build on the web platform, when in the editor it will use the standard setup.

Breakdown

In earlier versions of this asset, saving to web wasn’t possible. However in this version it is. This has mainly been tested on itch.io but should work on any build in theory. Web saves use a slightly different setup to the standard save setup with a different path and some additional logic to make it work.

In the engine, the save will still use the default setup for standalone builds as the web setup will only work in builds. When in a build the save will be placed in the IndexDB of the users browser and will remain there until their clear their browser data. The path is idbfs/{YOUR_GAME_NAME_IN_PROJECT}-{COMPNAY_NAME_IN_PROJECT}/save.sf, this is the persistent data path with a consistent path. If the asset used the default persistent path it would be unique for each play so the user wouldn’t have a save if they left the game and came back at a later date.