Search Issue Tracker

Fixed in 2019.2.X

Duplicate in 2018.3.X

Fixed in 2018.3.X, 2019.1.X

Votes

75

Found in

2017.4.0f1

2018.3.0a1

2018.3.0f2

2019.1.0a1

Issue ID

1112790

Regression

No

[VR]EarlyUpdate.XRUpdate's CPU usage increases by about 2.4ms every 10minutes if the Unity Player isn't focused on

XR SDK

-

Steps to reproduce:

1. Create a new project
2. Enable VR
3. Build for standalone with "Development Build" and "Auto-Connect Profiler"
4. Run the build with an HMD attached
5. Open the profiler window
6. Make sure it is connected to the player
7. Leave the player running while unfocused for at least 20 minutes

Result: CPU usage spikes start occurring, player becomes laggy and continues to become worse as time goes on

Reproduced on 2017.4.0f1, 2017.4.17f1 2018.3.1f1, 2019.1.0a13

  1. Resolution Note (fix version 2019.2):

    Fixed in 2018.3.10f1

Comments (32)

  1. orrbain

    Feb 25, 2019 01:24

    I see this is marked as resolved in 2019.2. Is there any change 2018.2 or 2018.3 is going to get this fix backported? We are like 2 months out from launch and would prefer not to have to launch on an Alpha branch of Unity...

  2. t-kuhn

    Feb 21, 2019 06:52

    I tried the QualitySettings.SetQualityLevel approach. Sadly, I wasn't able to get EarlyUpdate.XRUpdate's CPU usage to normalize.

  3. t-kuhn

    Feb 21, 2019 01:53

    @ORRBAIN
    Thank you so much for the detailed explanation!
    I hope this problem gets fixed in the near future. In the meantime, we're glad about any hint about how to possibly improve the situation (even if it's just a hackaround).

  4. orrbain

    Feb 20, 2019 13:11

    Also I should note it's entirely possible this is dependent on a bunch of stuff (I haven't tested the Quality Settings switch fix in an empty project for example, so maybe if the game is large enough with enough going on at once there is some sort of clearing or the big hiccup causes it to "reset"). Just making a note of it in case that helps the Unity folks track it down better.

  5. orrbain

    Feb 20, 2019 13:10

    We are specifically calling:

    QualitySettings.SetQualityLevel(1, true);

    And then in the actual Quality settings in Unity we have it set so that for example quality setting 1 is "High" with full res textures and then quality setting 3 is half-res.

    I've not tested doing it in like an "automatic" way (since switching between them causes a major hiccup anyway it's not like we could do it just every 10 minutes or something). But you would have to call it once to switch to the lower settings, then wait a second or two for it to do a big hiccup, and then again to switch back to the higher setting.

  6. t-kuhn

    Feb 20, 2019 09:06

    ļ¼ ORRBAIN

    Can you give us some more details on fix B?
    I tried to translate your explanation into code and ended up with the following:

    var ranNum = Random.Range(0, 3);
    QualitySettings.masterTextureLimit = ranNum;

    This gets executed whenever I push the menu-button of the controller. There are mip enabled texture in the scene. Depending on the number that gets set as the masterTextureLimit smaller or bigger textures are getting uploaded to the graphics card. In effect, this code should accomplish what you wrote in your explanation. But the problem described in this issue won't get fixed unless I use method A (i.e. refocus on the window).

  7. orrbain

    Feb 20, 2019 01:56

    Okay so I spent some considerable time testing this now. Here are the steps I am using to get it to happen consistently:

    1) Start the game.
    2) Unfocus the window (e.g. focus on a Chrome browser window).
    3) Place a piece of paper on the Oculus Rift presence sensor in the headset so it thinks you are wearing it still.
    3) Let the game run for 15 minutes or so.
    4) Every time, you will see the game slow down to 45 FPS.

    To fix it you can:

    A) Re-focus the window, which will instantly cause it to go back to 90 FPS.
    B) Our game has a graphics setting which switches between Unity's Quality settings. If you switch between a high-end one with full res textures and a low-end one with e.g. half-res, and back again, that will cause it to fix itself even if you never re-focus the window.

    I have observed this behaviour now in both Standalone non-Development and Development builds, on 2018.2.20 and 2018.3.6.

    Let me know if I can offer any further assistance to track this down. As I said although it consistently happens when you un-focus the window, we've seen it happen sporadically just during normal gameplay as well, so hopefully this gets solved soon.

  8. orrbain

    Feb 19, 2019 21:37

    I meant to say, we are also seeing it happen even if the window is mostly focused.

  9. orrbain

    Feb 19, 2019 20:00

    We are seeing the same thing, and sometimes it seems to happen even if the window is not focused. We've also found that if you switch Quality Levels between two levels that have differing amounts of Texture quality (e.g. Full res vs quarter res), it will clear it for a bit (it comes back later though).

    Here is an example profiler dump of it happening to us:

    https://www.dropbox.com/s/ndel833htabt0of/Running%20at%2029%20FPS.data?dl=0

    And then another dump of the exact same position in-world after it clears itself:

    https://www.dropbox.com/s/38mwnz8uz8o82ek/Cleared%20itself%20running%20at%2089%20FPS.data?dl=0

    This has caused a tremendous amount of problems for our userbase in our beta testing, can we at least get a confirmation from Unity this is being addressed in an upcoming patch?

  10. Frooxius

    Feb 16, 2019 16:49

    I've been dealing with this issue myself for months. Anytime I tried to upgrade my VR project from 2018.1 to 2018.2, 2018.3 and now 2019.1, this would happen, but the 2018.1 build would be fine (with exact same codebase).

    It's crucial to get this fixed, as there's often things that cause the window to get out of focus (e.g. users using Oculus Dash to browse web or interact with other apps) and it causes judder in otherwise smooth experience.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.