Search Issue Tracker
[WebGL][Chrome] game freezes after switching the browser tabs
1. Open the project, attached by the user (link in the edit)
2. Build and run for WebGL
3. In the build, switch the tabs back and forth a couple of times
4. Observe that the game freezes
Expected: the game doesn't freeze when switching between tabs
Reproduced in 2017.3.1f1, 2017.4.2f2
Could not reproduce in later and earlier versions due to shader and other errors in the console which prevents the building of the project completely
Aug 18, 2020 09:22
good one <a href="https://www.lyricsauto.com">lyricsauto</a>
Jun 15, 2020 09:15
Oct 01, 2019 11:59
Your web site seems so tremendous!
Jan 07, 2019 06:42
Hi, is there any fixes for this issue?
I had the same problem with cocos2d js, when the tab is inactive (switching tab) my game will be freeze because the setTimeOut / setInterval or requestAnimationFrame only be call at 1 per second or less. Then I found a trick to workaround this issue: I used web worker or shared web worker to update my models (position, orientation etc...) then when tab become active I re-render things. This make my game become active even if tab is inactive (my game is an online game).
But I don't know how to implement this in unity webgl (I'm new to unity). Does anyone have idea?
Oct 09, 2018 02:42
Yep fellow "Application.targetFrameRate" user too. Hopefully there's a fix in pipeline
Oct 08, 2018 20:22
Pardon me, AIFIRST. I didn't notice your comment now, I reviewed these comments before you posted. I came up with the same resolution as you. Cheers.
Oct 08, 2018 20:19
I've been researching this issue. I've just submitted a bug with attached project to Unity.
Here's what I've found:
WebGL app that is running in Chrome freezes when switching tabs, but only when custom target frame rate is set. It's not completely frozen but it's just not rendering. All sounds and mouse interactions are working, you just can't see anything on screen live.
To get back into running you can just resize current window or change scale in Chrome (Ctrl + mouse scroll or Ctrl + '+').
Also when setting FPS Chrome shows this error:
> Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!
Resetting FPS to -1 doesn't fix the issue.
Sep 29, 2018 09:01
I resolved by removing Application.targetFrameRate sentence.
If Application.targetFrameRate is present, webgl make warning
"Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"
and sometime freeze when minimize and recover.
I think unity3d should requestAnimationFrame when Application.targetFrameRate is present.
Sep 26, 2018 07:18
Same issue as PSCHAUSSPLAYA on 2018.2.9f1. Resizing the browser sorts it out but not a great user experience
Sep 18, 2018 08:12
Any update on this? This is a very serious problem as Chrome is the most popular browser. The probelm still occurs with Unity 2018.2.8f1.
It can be easily reproduced by keeping the game tab inactive for a while. Either by opening another tab or by minimizing the brower window. Sometimes a minute is enough, sometimes it needs to be more time.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Variable is set to a different value from the selected enum value in the Editor dropdown
- TreeView Child display toggle styling becomes reversed when clicking and dragging it
- Null is returned when using FocusOutEvent.relatedTarget
- Unity_BaseInstanceID is always zero when rendering multiple meshes and instancing with the same buffer
- UI Document button's text does not resize relatively when size in percentage (%) is used
This is a duplicate of issue #1088870