Jump to content

Disable game pause when focus lost


Croweley
 Share

Recommended Posts

I've tried using 

stage.disableVisibilityChange = true

but it doesn't seem to do anything (I'm hoping that the update method would continue to be called when the window/tab loses focus). Here's a small project that showcases this:

 

var game = new Phaser.Game(1280, 720, Phaser.CANVAS, 'game-container');game.state.add('Boot', Boot);game.state.start('Boot');
var Boot = (function ( ) {    Boot.prototype = Object.create(Phaser.State.prototype);    function Boot ( ) {                Phaser.State.call(this);            }        Boot.prototype.create = function ( ) {                console.log('create');        Phaser.State.prototype.create.call(this);        this.game.stage.disableVisibilityChange = true;            }        Boot.prototype.update = function ( ) {                console.log('update');        Phaser.State.prototype.update.call(this);            }    return Boot;    })();

It'll work as expected until I change tabs, at which point the update method is no longer called. Thoughts?

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...