My game is always getting restarted completely when the device was set to pause mode.
Is there a way to keep the game on and running, so a level can be continued after a user returns to the game for example the next day?
My game is always getting restarted completely when the device was set to pause mode.
Is there a way to keep the game on and running, so a level can be continued after a user returns to the game for example the next day?
device os wont permit your game to stay in the background for so long, you need to detect that the game is entering sleep mode and do a quick save command (wont allow you to run any fancy code), or even better, keep saving progress while player is playing so that he can come back to where he was, no matter what causes the game to interrupt and close
this is unfortunatley part of the challenge when making an app for devices, unlike when making a game for a desktop os, where the user is used to either save the game, or exit the game from within, allowing the game to run any code to save state before gracefully exiting.
While anaqim is right, if you are finding the game quits immediately after going to the iOS home screen, you need to add this key in build.settings:
[lua]
iphone = {
plist = {
UIApplicationExitsOnSuspend = false,
},
}
[/lua]
This *might* keep the app in a state where the user can go back to where they were for a few hours, but if other apps need the memory yours will be closed to make space, so it’s best to also implement anaqim’s suggestion too.
device os wont permit your game to stay in the background for so long, you need to detect that the game is entering sleep mode and do a quick save command (wont allow you to run any fancy code), or even better, keep saving progress while player is playing so that he can come back to where he was, no matter what causes the game to interrupt and close
this is unfortunatley part of the challenge when making an app for devices, unlike when making a game for a desktop os, where the user is used to either save the game, or exit the game from within, allowing the game to run any code to save state before gracefully exiting.
While anaqim is right, if you are finding the game quits immediately after going to the iOS home screen, you need to add this key in build.settings:
[lua]
iphone = {
plist = {
UIApplicationExitsOnSuspend = false,
},
}
[/lua]
This *might* keep the app in a state where the user can go back to where they were for a few hours, but if other apps need the memory yours will be closed to make space, so it’s best to also implement anaqim’s suggestion too.