How do I resolve game restart when brought on focus?

0 favourites
  • 5 posts
From the Asset Store
A game template with a great amount of assets! You will be able to create a full game just with the assets provided!
  • I have a link to my website in my mobile app. When the link is clicked it opens my website in a browser. The problem is when I go back to my game it restarts.

    Sometimes the game sits in the background for awhile and then I bring it on focus, it restarts.

    Is there a way to prevent it from restarting?

  • Mobile OS can unload apps running in background from memory. I don't think you can prevent this.

    You can save the game state before opening the browser. And next time the game restarts - load that state. If the game resumed successfully without restarting, then you can clear the saved state.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I am trying to determine the difference between:

    a) When a user clicks a link a browser window is opened. User goes back to game and it always restarts the game.

    b) User selects another app, my game is in the background. User selects my game (it has not been closed) and is now in focus. The game has not restarted.

    Is there a way I can tell if it is focused and when it becomes unfocused?

  • I am trying to determine the difference between:

    It actually may work differently on other devices. If a phone has a lot of RAM, the game may not be unloaded. If there is limited RAM, the game may be unloaded even if the player simply minimizes it or locks the screen.

    You can use System On Suspended and System On Resumed events.

  • Thanks!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)