Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question WebGL Save to persistentDataPath

Discussion in 'Web' started by Mpx83, Aug 15, 2023.

  1. Mpx83


    Apr 4, 2023

    I need to save some data to Application.persistenDataPath in a WebGL application. I saw that writing a file with unity to that path won't work unless some javascript is added to syncronize the file.

    Code (JavaScript):
    1.      SyncFiles : function()
    2.      {
    3.          FS.syncfs(false,function (err) {
    4.              // handle callback
    5.          });
    6.      }
    I tried it and it works. I was just wondering, is this the "correct approach" or there some method implemented in unity?