Skip to main content

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

DynamiteWhale

6
Posts
2
Topics
8
Followers
A member registered Feb 26, 2017 · View creator page →

Creator of

Recent community posts

The persistentpath-saving I do like this (if it matters...)

C# using System.IO

        FileStream stream = File.Open(Application.persistentDataPath + "/test.json", FileMode.OpenOrCreate);          

        StreamWriter write = new StreamWriter(stream);
        write.Write(JsonUtility.ToJson(state));    
        write.Close();

(1 edit)

Hey,

I guess the new path is what creates this problem.

I do not know where exactly unity stores their "PlayerPrefs" but according to some posts on the unity forum #1 #2 PlayerPrefs used the IndexedDB.

I tried an alternative way by storing a JSON in unity's builtin persistentDataPath.

When I log the path to the browsers console in my test-project, the path I get is: "/idbfs/90b3e05603d8efe64ce5c035f88e6b1f"

Saving and retrieving the json fron there is no problem, but has the aforementioned issue when updating the project.


EDIT:

. In my test project I am also saving to playerprefs - and the path in the indexed DB for that, seems to be:

/idbfs/90b3e05603d8efe64ce5c035f88e6b1f/PlayerPrefs

- the JSON I save to the persistentpath ends up here: /idbfs/90b3e05603d8efe64ce5c035f88e6b1f/test.json

Other paths that unity seems to create or use:

"/idbfs/90b3e05603d8efe64ce5c035f88e6b1f/Unity""/idbfs/90b3e05603d8efe64ce5c035f88e6b1f/Unity/local.7f8d86c75cc3fab4aab80b5a6b4ef072""/idbfs/90b3e05603d8efe64ce5c035f88e6b1f/Unity/local.7f8d86c75cc3fab4aab80b5a6b4ef072/Analytics""

(1 edit)

Hello Everyone,


I have spent some time trying to find a good solution for saving game-data (e.g. save games) in a way that persists also after an update on itch.io.

So far my experiments on itch have revealed the following - and please correct me if I am wrong on this:

Any update of a game (even when uploading the same zip/build as an update), will put the game into a different domain (not sure if this is the right word). What I mean is, that any data stored in an indexedDB (afaik Unity also uses indexedDB to store playerprefs), will not be accessible after the update anymore because the browser treats this as a "new" instance the game.

This only leaves some unconvinient options to store playerdata:

  1. Host own user accounts. Players can create an account with a username, and the game will save game data on a 3rd party server. Players can retrieve their savegame by entering their username/password.
  2. Save-game-to-file. Players can export the savegame to XML/Json or an encrypted binary to their drive. 

I have the feeling I am not seeing the obvious solution, or am understanding something fundamentally wrong with the way itch handles updates.

Thank you in advance,

The Dynamite Whale

Thank you leafo. Looks like I got a bit confused :)

Hello out there,

Our new project "MazeBot" just released the first public version (on itch.io). We have a couple of levels, basic mechanics implemented, and before we go ahead with implementing all the crazy stuff that's on our mind, we want to see where the project is headed. 

So please, give it a try, it would be totally awesome if you'd help us by filling out the survey:

https://goo.gl/forms/tioVPGJgvKA1aUAU2