Process of Saving files?

I’m so confusing :joy:
I’m almost done with my first game and yesterday i faced on saving problem with my native(app)game.

1…The game has two button ‘save’, ‘load’
when i save the game and load, it works well only ‘running’ the game

(sure i add sub event for write variables in storage when click ‘save’
and read variables in storage when click’load’)

then i quit and restart game and select ‘load’ button, it never works

2…but now i solved it
in the beginning of the game (it has introducing scene)
i added sub event for read variables from storage
so when i quit the game and restart , then i can see the saved status…

anyway i solved this problem(instead i don’t need 'load’button anymore because it’s seems like auto load when beginning)

But the main is why ‘1’ never works and ‘2’ works well
i thought when i write the values in storage , the storage file is made in somewhere and i can read it whenever i quit the game or running
but as ‘1’ ,it seems not. and as ‘2’ it works
(if there’s no problems, it might be on ‘click’ event)

Plz share your ideas about process of saving files

1 Like

does it happens on preview mode or in the exported game?
I think when you are in preview mode inside gdevelop it works until you close gdevelop as it should use temporary files.
If it is in the game exported will have to look at the code
For me works fine on android

I’m not exactly sure why 1 isn’t working in your case. The first method you described is the one I use and it works just fine, even after I close the preview and open it again.

Are your buttons working properly? Something tells me your Load button might be the problem, and not the loading process. Perhaps your Load button isn’t actually loading anything?

Instead of adding the Load Storage events as a Sub-Event to the Load button, maybe try and do something like this:

If touch or Left mouse button is down
If the cursor/touch is on NewObject
If scene variable "Load" = 0
  do = 1 to scene variable "Load"

If scene variable "Load" = 1
  If "thisvalue" exists in storage "One"
    Read "thisvalue" from storage "One" and store value in "varOne"
    do = 0 to scene variable "Load"

This way, regardless of how long you hold the button or how much you click it, it should load just fine.
Also, the “If thisvalue exists in storage” is a good way to make sure it won’t load null values.

it happens on preview mode
anyway the thing is the problem solved…
I think i should test more in different conditions.

thx for reply :slight_smile:

thx for reply
and now i finally complete to make my games and trying to make another simple games
and i’ll try your method when i need the ‘storage system’ again
have a nice day :slight_smile:

I was having same problem too but now everything is fine…Now problem is Save/Load function works very well on Windows10 but not working on Android Mobile…Do i require permission from user in order to access the storage of Mobile…i think my save file is not being saved in the Android Mobile resulting in failure of Load function

You already made one topic that’s enough no need to repost your questions in other topics :wink:

I got it…Sorry