• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code INI file contents get deleted on their own

M

mza1979m

Guest
I've been having this disturbing issue with my game. I've been developing it for 2 months on GMS2 and have put massive amounts of effort into it, but there is just one issue that is constant, and no matter what I do, it won't go away...
The game would run, and everything appears to be fine. I have about 73 ini_open() and ini_close() statements to save variable values to an INI file. The maximum size of the INI file reaches 33kb. I could launch the game 20 times and everything would be fine and it would preserve all variable values as expected and recall them on the next run. However, once in a while I would launch the game and find that everything in my INI file has been deleted and the game literally restarts from the beginning as if no progress was saved to the INI file at all. This happens maybe once every 20 launches. It has happened during testing on my Android phone as well. I actually tried replacing the entire INI file saving system with a 3rd party saving asset (playerprefs_gm), and strangely it now does it more frequently. The .sav file created would just get erased once in a while and progress is reset. Could this be a problem with GMS2? Or could this be related to the fact that I'm in 'test' mode and the game isn't actually compiled?
 
Don't mess with the ini files so often. Create a script to save the game and a script to load the game. Only call the save script when you want to save all the variables at once, and only call the load script at the start of the game. Otherwise you're just asking for trouble.
 
M

mza1979m

Guest
Are you referring to the new built-in save/load features of GMS2? If not, then what would the contents of these scripts look like?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I would think your issue is caused by the cache being cleaned and rebuilt. When testing GMS2 caches al the files to make the build process faster, but this can be cleared, especially when large changes are made to the project). You should make a final build (create Executable) and install that APK on your device and see if it still happens. If it does then file a bug.
 
M

mza1979m

Guest
Still did the same thing after creating a final build and playing on Android. Reported it as a bug.
 
Top