Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug High FPS When "Unfocused" low fps when "Focused" (2022.3.5f1)

Discussion in 'Editor & General Support' started by TragicallyCanadian, Jul 27, 2023.

  1. TragicallyCanadian

    TragicallyCanadian

    Joined:
    Mar 26, 2020
    Posts:
    30
    As the title suggests when my editor or build is "Focused" the fps is extremely low. Around 60ish, give or take. (I have V-Sync disabled)

    When I click off the application or the editor window, FPS shoots up to 200-400.

    I am using a completely empty scene.

    Any idea what's happening here?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    First of all: 60 fps is not extremely low. It's pretty much standard framerate. ;)

    I can't reproduce this. In fact, when the editor is not the focused window it essentially stops rendering as it should, fps drops accordingly in the Game view's Stats display.

    How are you measuring fps?
    Vsync may not always work reliably in the editor. It can also be overriden by the video driver, and Preferences => Editor => Interaction Mode may also factor into this.
     
  3. TragicallyCanadian

    TragicallyCanadian

    Joined:
    Mar 26, 2020
    Posts:
    30

    It is extremely low for an empty scene in comparison to the 400 it gets when unfocused is the message I was trying to get across with my above statement. 60 FPS is certainly fine for an end product, for an empty scene with nothing in it but a camera, something seems to be off.

    FPS is being measured using the stats window in one test, and on another test I am adding a script to an empty gameobject, which collects the average frames across a set time and prints them onto a UI element.

    This also happens in builds of the project, not just the editor.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    Hmmm that seems more likely to be an issue with your system than with Unity.
    60 fps seems perfectly fine if Vsync is enabled. Like I said, it may still be enabled even if you unchecked that vsync box in game view and/or in quality settings. It may be forced by the driver. Speaking of which: perhaps try updating, and use the Nvideo stock drivers not the vendor drivers. You could also try the "Studio" version of the driver, I personally use that because I rather go for stability and compatibility.

    In any case, try [Graphy] to get reliable fps results, many scripts out there aren't measuring correctly and it's just such a great tool to have in your toolbox.
     
  5. TragicallyCanadian

    TragicallyCanadian

    Joined:
    Mar 26, 2020
    Posts:
    30
    I suspected it might be a local hardware issue, so I pushed a build on our developer page. 5 Other devs on the project tried it, all with the same results. It's worth noting I never noticed this in Unity 2021. I recently installed 2022 LTS, now it's a problem even on a fresh project that is completely empty.
     
  6. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    URP or Builtin? I tested with URP. Not sure if that makes a difference.

    If you can't reproduce this in 2021.3 you could submit a bug report.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,498
    Did you try looking at your graphics driver settings? 60 FPS sounds like something is forcing VSync, GSync, FreeSync or some similar tech on. The fact that focusing away makes the frame rate go up reinforces this suspicion as these things generally work only when the window is in focus.
     
  8. TragicallyCanadian

    TragicallyCanadian

    Joined:
    Mar 26, 2020
    Posts:
    30

    I assumed that would be the case, I disabled G-Sync and it was still happening. Oddly enough after I re-built the project and re-cached the shaders for whatever reason that problem doesn't seem to be happening anymore. I have no idea why it's no longer present. If it re-appears I will re-comment on this thread with the steps to reproduce.