Is there a way to shutdown the playcanvas application?

We want to shut down or pause or application when the user change the current window, something like this…

document.addEventListener('visibilitychange', function()
{
    if (document.hidden)
    {
       pc.Application.getApplication(),destroy();
    }
});

Hi @Axel_Saucedo,

Calling destroy() will indeed destroy the active PlayCanvas app instance.

If you would like to stop rendering, you can use the autoRender property. Setting it to false will pause all rendering operations in the PlayCanvas app.

Though keep notice that any input handlers like mouse events will still be active.

this.app.autoRender = false;

Putting it back to true will resume rendering.

In the same manner to stop the physics simulation, use the timeScale property, putting it to 0.0 will stop updating it.

2 Likes