Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question WebGL Save to persistentDataPath

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

  1. Mpx83

    Mpx83

    Joined:
    Apr 4, 2023
    Posts:
    21
    Hi,

    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?