Jump to content

Switching to a different screen


DylanD
 Share

Recommended Posts

Good morning everyone,

I noticed in my scene if someone were to switch away from the tab(in browser tab I mean) that the game would keep running but would not run properly, as in intersects mesh would recognize intersecting, and some other stuff.  I was wondering if there was a way to check if the left the page or something like that so I could make it hit my pause button.

Any ideas?

Thanks everyone!

Link to comment
Share on other sites

5 minutes ago, Deltakosh said:

Hello you can register with window events:

window.addEventListener("blur", this._onBlur);

window.addEventListener("focus", this._onFocus);

Blur being leaving the screen? and focus being coming back to the screen... I assume.

 

Thanks DeltaKosh I will try it out!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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