Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+6)

I've managed to work around this by saving to/loading from "idbfs/GameName" rather than Application.persistentDataPath in WebGL builds. I saw metinevren suggested that here too: https://forum.unity.com/threads/persistentdatapath-returns-different-paths-for-d...

HOWEVER, PlayerPrefs and a bunch of other unity stuff still use the persistentDataPath (eg "/idbfs/b647bc5784577....".) and I'm not sure how to change that. I'm not using PlayerPrefs so it's not an issue for me.

Also don't know if this workaround is icky for other reasons. But I can now upload new builds as much as I like and my savegame persists!

Hey I know this is super old but I'm using binary files to save. Does this look like roughly what you got working? I'm still having some trouble with this.

public void SaveGameStats()
{
    string saveFileName = "GameStats";
    string savePath = Application.persistentDataPath;
    #if UNITY_WEBGL
        savePath = "idbfs/Skull_Scavenger";
    #endif
    using (FileStream file = File.Create(Path.Combine(savePath, saveFileName)))
    {
        new BinaryFormatter().Serialize(file, curGameStats);
    }
}
(+1)

Hey! I haven't gone anywhere near this stuff in a long time so forgive lack of context but looks like I haaad...

#if UNITY_WEBGL         
    mPersistentDataPath = "idbfs/LittleThings"; 
#else         
    mPersistentDataPath = Application.persistentDataPath; 
#endif

aaaand...

SaveLoadUtility.CreateDirectory(mPersistentDataPath);             
SaveLoadUtility.SaveDataToBlob(appState, mPersistentDataPath + mSaveDataPath);
(+1)

Awesome thanks, the post you made actually helped me figure it out with info from a few other people.