Error or bug saving?

Hi, i need someone who can solve this… in the picture you see how i’m saving the progress in the game, this is for all the levels (2,3,4,5,…98,99) but… Sometimes it doesn’t save the game… maybe 2% of the times that i close the game correctly, i mean not just closing the window in the browser, i mean by clicking the “Exit” text object which actions are.

1.- Exit game
2.- Javascript: window.close()

I wanna put the game in play store soon, but this is and ugly error, cause the players can finish 2 hard levels, and close the game, and then the next time they play maybe they have to play again this 2 hard levels…

Already fixed in the next version. Meanwhile, you can use the open/close file actions around your saving actions.

Sorry Victor, what do you mean with the open/close actions around it?

Hi ! Well, I think I do not have problems with save and load game with my projects; but I work like this:

To save, I create a variable called, for example SAVE.

Than, when I want to save, the button pressed change de variable SAVE to 1

When SAVE is = 1 it saves all other global variables used as the saved information( I just use global variables to save ), and after saving all variables the SAVE variable turns to 0 again. So, like this I thing we are sure that all information is saved before stop saving.

To load I need to create scene variables to load the information from the saved file, and after loading this data do scene variables, this data is copyed to the glogal variables corresponding to it. The same logic here, I have a LOAD variable that starts with 0; and after pressing the LOAD button, this variable LOAD turns to 1. After loading everything to scene variables and sending data to global ones, the variable LOAD turns to 0 again.

It is working fine on mobiles, web and native. No problems with that.

I suppose you are saving the same way as me. With the same method, by storage, you need to push a button or and object, so Variable save = 1 then write value of global variable x to sabe.txt or whatever, if it’s like this is exactly like me just diferent condition, and in 2% of the cases it won’t save, if you are not doing it like this can you upload a screen capture please.

Hi xai1985,

Yes, the same solution we are using. Here screenshots as you requested, but as you said, probably we are doing the same thing. I could not notice the error yet. Everything looks pretty, but maybe I am wrong about that.

Here, after the last line, I call the variable SAVE to 1( a little different as I had mentioned ):

And here, the SAVE = 1 Condition, so the game calls the creation of an animated bar to show save progress( fake ) :

Yes, you are using the same method, the storage, in this case you’ll see that sometimes it doesn’t save the data, as i said is not happening everytime, just like 2% of the times or something like this, but still a problem if you wanna sell it or make some money with it :frowning:

There’s a bug in HTML5 storage that have been fixed in the next version, can you try this file : … getools.js (paste it inside GDevelopFolder/JsPlatform/Runtime and then rebuild your game)

Thanks, i’ll try it and try to test it to see if it’s working now.