Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by aaronlr · Nov 11, 2015 at 01:26 PM · webglpauseswitchbrowsertab

Game pauses when user changes browser tab (even with RunInBackground)

Hi!,

I'm developing a simple webgl game, where the user has to click some buttons in a given time in order to get to the next level, but I've found a problem with the game pausing if it loses focus.

Setting the "RunInBackground" option in the player settings fixed one problem, now the game doesn't pauses when the browser loses focus, but it still freezes if the user switch the active tab on the browser.

Am I missing something? Is there a workaround to fix it?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Schubkraft · Nov 11, 2015 at 01:47 PM

We've added some more info about this in a future version of the manual:

If the Run in background is enabled in the WebGL Player Settings, or if you enable Application.runInBackground, then your content will continue to run when the canvas or the browser window loses focus.

However, it should be noted that browsers may throttle content running in background tabs. If the tab with your content is not visible, your content will only be updated once a second in most browsers. Note that this will cause Time.time to progress slower than usual with the default settings, as the default value of Time.maximumDeltaTime is lower than one second.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image aaronlr · Nov 11, 2015 at 02:44 PM 0
Share

Is there a way to know if the tab has been switched in the current version of unity? I've figured out a way to deal with my particular problem, a simple re-arrange of the buttons will do the trick for me, but first I need to know if the tab has been switched.

avatar image Schubkraft ♦♦ aaronlr · Nov 11, 2015 at 02:52 PM 0
Share

you could try something like this http://stackoverflow.com/questions/1760250/how-to-tell-if-browser-tab-is-active

and then ping that info back to your webgl content (see the manual on how to send stuff between the page and unity content)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

WebGL - Open URL in new tab? 10 Answers

Gracefully handle unsupported Web GL 2.0 Browsers 0 Answers

What is abort 127 0 Answers

WebGl Mouse Controlls and Browser Behavior 1 Answer

Can I display an Unity WebGL Game in Unity Editor ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges