I have a game which is exported to Gd.Games. When loaded on IOS it loads the GD.Games page but doesn’t seem capable to read the storage previously saved. When the GD.Games link is opened on Windows PC/or via preview it has no problem loading/Saving from storage (even after shutting down browser and reloading). On IOS, it doesn’t see storage previously saved but it’s able to save and load from storage during the session, when the browser is closed and reloaded it seem the storage is no longer saved - it appears the value in storage are no longer there. This is annoying as I can’t get people to test as saved progress is not able to be loaded when users close the browser and reload. The fact that its working perfectly on preview and Windows is weird.
You’re testing this on a browser, on iOS.
If yes, then this means that the browser is clearing cookies each time you start a new session.
This is because when you’re playing on the browser, storage is saved to a cookie. And there are many browsers that clear cookies by default
Your only solution is to tell the player not to clear cookies after every session.
I’ve never used iOS but I think Safari has an option to keep cookies and not delete them
This is incorrect.
Storage events store to the browser localstorage db, which are not cookies.
Would the localStorage Db be wiped on closure of the browser on IOS? If I don’t close the browser but refresh, the game loads the storage fine. When I close it down (swipe up) and reload the Gd.Games URL , its unable to load the previous storage (both Safari and Chrome same issue). I know the storage is working as I am able to save and load saved storage between scenes. But as soon as the browser is closed and relaunched, it’s like the storage doesn’t exist. As I’ve said - this is only using the Gd.Games link on IOS. If I preview, on Windows or IOS via Gdevelop / or open the url via windows (Edge and Chrome) there is no issues closing browser/game and reloading.
Only if the browser is set to clear all stored data for sites upon closed (not just cookies). That would wipe the localstorage db, but I don’t even know if mobile safari has that option.
I’ve tried everything, but on IOS (opening a link to GD.Games export) it is never able to load storage previously created once the browser is closed. Here is my code, as you can see, when storage is not found, it creates a username “Unknown Player” and saves to storage. If I go to another scene (where the player edits the username - which saves to storage) and returns, it will detect the new username correctly via load from the storage and display the username correctly. If the browser is closed down it will not find the storage and will regenerate the “Unknown Player” again and save this.
PS:// I know code is inefficient - I’ve been trying to make sure text is being save using scene variable as some feedback suggested global variables don’t work with loading/saving to storage
This may not solve your issue but I REALLY recommend never combining storage events with waits.
They are both asynchronous and could cause issues if the browser is taking a long time to access the storage.
Separately, are you using trigger once anywhere in your process? I don’t see it in your screenshot and you’d definitely want it with both save and load events.
Thanks for the reply - yes, I agree, the waits were added to make sure it wasn’t an issue with timing. If I remove them (which I have now) the problem still exists. this sits under “Run at beginning of scene” - I have added the trigger once to both now - problem still exists.