Search Unity

Game in iframe freezes when it loses focus

Discussion in 'Web' started by seldom, Mar 26, 2019.

  1. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Hi,
    I'm running my game in an iframe. When the user interacts with the rest of the page, the iframe loses focus and the game freezes until it gets the focus back. How can I keep the game running? I've tried enabling
    Application.runInBackground and PlayerSettigns.runInBackground, both had no effect.
     
  2. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Any clues? I'm really stuck with this. It's happening on both the latest Firefox and Chrome. The game is built with 2018.2
     
  3. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Fixed it for now by wrapping the iframe's window.addEventListener and ignoring listeners for focus and blur events. I'm still looking for a proper solution.
     
  4. ZemSoft

    ZemSoft

    Joined:
    Jan 3, 2017
    Posts:
    4
    Hi.

    We have the same problem and are looking for a solution. We have a game on the Facebook canvas app.
    If you have found a solution, please share it.