Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Game performance degrading when window does not have focus

Discussion in 'AR/VR (XR) Discussion' started by raithza, Mar 12, 2019.

  1. raithza

    raithza

    Joined:
    Dec 14, 2011
    Posts:
    21
    Hi,

    Per this issue: https://issuetracker.unity3d.com/is...10minutes-if-the-unity-player-isnt-focused-on

    Many of our users have been complaining about this bug, as sometimes SteamVR will switch focus away from the game window when the game is started. Looking at the bug report it looks like it won't get fixed for Unity 2018.3, and we definitely can't upgrade our production version of our game to a beta version of Unity. Does anyone know of a workaround for this issue? Or perhaps some way of forcing focus to the game window?
     
  2. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    311
    The fix is being back ported to 18.3. I'm don't have a specific version of 18.3 as of right now, but I am trying to land it in the earliest release possible due to it's severity. Depending on your time frame for shipping your game, if you can wait a week or two for the fix, don't upgrade to 19.2.
     
    raithza and ThiagoAtOxfordVR like this.
  3. raithza

    raithza

    Joined:
    Dec 14, 2011
    Posts:
    21
    Thank you, that's great news.
     
  4. Split82

    Split82

    Joined:
    Aug 27, 2013
    Posts:
    7
    Will the fix be available for 18.2 too? Does anyone found any workarounds?
     
  5. return_chris

    return_chris

    Joined:
    Jul 19, 2017
    Posts:
    1
    BigscreenVR dev here. Our issue was ballooning PF delta when backgrounded, killing our perf after a minute. We tracked it down to some mishandled WndProc messages related to focus and activate, so we overrode the WndProc with our own, and sent these message types to the default message handler instead of Unity's. Hope this helps!
     
    jashan and JamesThornton like this.
  6. raithza

    raithza

    Joined:
    Dec 14, 2011
    Posts:
    21
    The latest patch notes state: "XR: Fixed performance degradation over time for Virtual Reality applications. (1130392)"

    Can someone confirm that it's the same issue as listed above? Only asking for clarification because the issue ID's do not match (in patch notes 1130392, issue id on tracker 1112790)
     
  7. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    311
    I can confirm that is the fix. The issue tracker ID for 2018.3 was different from 2019.1 because of our back port tracking. The fix should be out in 2018.3+ latest versions.
     
  8. raithza

    raithza

    Joined:
    Dec 14, 2011
    Posts:
    21
  9. ryan-challinor

    ryan-challinor

    Joined:
    Jan 28, 2014
    Posts:
    9
    After updating to 2018.3.9, I'm still seeing the issue, and I'm worried about waiting to see if 2018.3.10 actually fixes it. Would you be willing to describe your workaround in more detail? I've looked around, but I'm not sure how to override the WndProc. Is this something you need a Unity source license for, or are you able to do it in C#?
     
  10. ryan-challinor

    ryan-challinor

    Joined:
    Jan 28, 2014
    Posts:
    9
    Update: 2018.3.10 came out, and I verified that it fixed the issue for us.
     
    raithza likes this.
  11. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I'm getting a report from a player where we have the exact opposite: When the game window has no focus, performance is fine (90FPS) - but when the game window has focus, performance is atrocious (22FPS).

    I can't reproduce this issue on my end, but here's some data from our logfile (that doesn't show anything suspicious otherwise):

    Code (CSharp):
    1. Initialize engine version: 2019.3.9f1 (e6e740a1c473)
    2.  
    3. Direct3D:
    4.     Version:  Direct3D 11.0 [level 11.1]
    5.     Renderer: NVIDIA GeForce GTX 1060 6GB (ID=0x1c03)
    6.     Vendor:  
    7.     VRAM:     6052 MB
    8.     Driver:   26.21.14.4587
    9.  
    10. OpenVR initialized!
    11.  
    12. Created eye textures with a "double wide" layout.  The "single-pass" stereo mode will be used.
    13.  
    14. Windows 10  (10.0.0) 64bit
    15. Processor: AMD Ryzen 7 1700 Eight-Core Processor  --- Cores: 16 --- Frequency: 3000
    16. Graphics device: 'NVIDIA GeForce GTX 1060 6GB', vendor: 'NVIDIA'
    17. VR SDK: OpenVR
    18. HMD: Vive. MV (HTC Vive)
    19. Initial resolution: 1512x1680 (game SS: 1)