I am using a scriptable object for saving data. I know that scriptable objects are unchangeable means we can't change and save data after runtime but is there any workaround available to update it? Or write any config file (editable for user to change it) on webgl Platform. It seems that file writing permission is not available at unity Webgl.


1 Answer 1


Sorry, but it's simply not possible for browser-based applications to write any files at all. That's just not how browser-based applications work (thankfully - just imagine what bad people could do when they could write any files they want to your local filesystem while you visit their website). When you need persistence in a Unity WebGL game, then there are basically two options.

  • Use the PlayerPrefs class. On the webGL platform , it's implemented by the indexedDB api, which works similar to browser cookies, but allows to store a lot more data in a more efficient manner.
  • Create your own webservice API which allows game clients to store and retrieve savegames stored in a database you operate. You can't do that in Unity, but there are countless technologies available for doing that. Your game can then access that API with UnityWebRequest for uploading and downloading savegames.
  • \$\begingroup\$ I'm not that familiar with Unity; would this be an option too? WebGL: Interacting with browser scripting, where they would use themselves the IndexedDB API you linked to via JavaScript they wrote themselves? \$\endgroup\$
    – Vaillancourt
    Mar 29, 2021 at 13:55
  • 1
    \$\begingroup\$ @Vaillancourt Well, you could, but that way your game will only run in the web browser. Relying on browser-based javascript means your game is not even going to work in the Unity Editor anymore, which really kills your iteration speed. PlayerPrefs is a way which uses indexedDB which also works in the editor and also when you build your game for any other supported platform. \$\endgroup\$
    – Philipp
    Mar 29, 2021 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .