Create a variable number = 0
On Start of layout, compare if it is = 0 (Means that the game was restarted)
- Set the value to LocalStorage
- Set the variable to = 1
You can also do it using On suspended but I don't think that it works when you close the app, is probably easier just to compare if its a fresh run.
That should do the trick, thanks bro!
Edit: Actually that worked, but, in a way that i didn't want tho. Like i said, i somehow want to detect if the game was closed when it's closed, because, i'm making a bullet hell game, that the number of deaths will be crucial to this, so, if the player is about to die and then closes the game to restart the fight 'fast', will just mess up with the death system. If the player reaches a certain amount of deaths ( that are saved in a local storage ) will trigger some functions, if the player closes the game, won't count as a death, that's why i'm looking forward this. Btw, thanks for the help too!