![]() That's why most browsers now don't allow even read access to any other files when opening a html file locally. However this is of course a huge security risk if you download an html file into your downloads folder and when opening the file locally, it would have access to all your files in your downloads folder. In the past browsers simply allowed read access to other files in the same directory in order to run a website locally. ![]() Most browsers have even stricter security rules for html files loaded from the local file system. The file system restrictions are not made by Unity but by browsers security policies. Just keep in mind that the memory is usually restricted, though that's usually not an issue. So you can happily create "folders" and "files" in the persistentDataPath as you could on a local machine. Though for properly hosted content, browsers offer the IndexedDB API which Unity uses to wrap the System.IO methods using the "/idbfs/" filesystem. You have to create this path and replace GAME_NAME_PLUS_UNIQUE_HASH with something unique of course.Ĭlick to expand.Unity didn't made it "hard" at all. The solution is to avoid using PlayerPrefs and Application.persistenDataPath and save to the path “idbfs/GAME_NAME_PLUS_UNIQUE_HASH” instead. This really messes things up when performing updates to your game, as even PlayerPrefs break. Than you save it and reset this flag in LateUpdate. You should set it whenever the game state changes and needs to be saved. ![]() In my experience, best thing you can do is having a changed flag for your game state. Yes it makes it unique, but it doesn't play nice with hosting services like itch.io and facebook. As mentioned above, your game will crash sometimes, so saving data only in these callbacks would lead to players losing their data. I think the problem is how Unity generates that folder. While this should be fine, it actually causes Application.persistentDataPath to generate a new directory with a new hash, making the old data essentially lost.(PlayerPrefs and persistenDataPath point to the same place) Every time you upload the latest build, they put the game in a different location. The problem is with other services, like itch.io or facebook. If you have your own hosting solution, PlayerPrefs and other saving methods should work fine. Sorry to revive an old thread, but this was the first result in Google.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |