Search Unity

Question GPU usage 100% on super light 2D project at 1080p 60fps - Apple Silicon M2 Max

Discussion in 'General Graphics' started by johannesQb, May 24, 2023.

  1. johannesQb

    johannesQb

    Joined:
    Jan 18, 2022
    Posts:
    10
    Hi, I have a super ligth 2D project on a macbook pro with M2 Max. I don't understand why GPU usage goes to almost 100% when the resolution is only 1080p and target framerate 60 (as you can se in unity stats).
    I have a script with these two line:


    Code (CSharp):
    1.         QualitySettings.vSyncCount = 1;
    2.         Application.targetFrameRate = 60;
    I've noticed that vSyncCount don't work; if a remove targetFrameRate=60 the game runs at 1000+ fps, instead of 120Hz (the display refresh rate of macbook with promotion); i tried to set macbook display at 60Hz, but nothing, the vSyncCount don't work.

    Another things i don't understand is why CPU in activity monitor goes to 174%, but in the graphics it seems low usage. But probably it's a little OT topic.

    GpuIssue.png
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    Check the profiler to see what takes up as much performance.
     
  3. johannesQb

    johannesQb

    Joined:
    Jan 18, 2022
    Posts:
    10
    I'm not expert about Profiler, but looking at that i can't see where is the problem:

    Profiler1.png Profiler2.png
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    If you click on the yellow/orange part in the graph you can see the timeline at the bottom to see where performance goes
    You can also enable GPU profiling module to see more info on that
     
  5. johannesQb

    johannesQb

    Joined:
    Jan 18, 2022
    Posts:
    10
    Ok thanks, anyway there's smothing wrong with vSync, i don't know if it's correlated with this apple silicon version of Unity, i'm pretty sure i didn't have these problems with the same version of Unity on windows.
    For example, if a change QualitySettings.vSyncCount (and save), Unity sometimes don't apply the modification until I restart Unity.
    Now gpu load is 10% at 120fps, and it's correct, but if set QualitySettings.vSyncCount to another value, for example 2 or 3, even i save and restart Unity, the fps won't change. And accordingly to the documentation, if I set vSync to 2, it should goes at half of the Hz, in my case 60fps, and 40fps with vSync 3. Instead it's always 120fps.
    I don't know if the reason of that is correlated with the playmode of the unity editor, i'm searching fot a tool for monitoring fps in a build version of same project and check if vSync does work
     
  6. johannesQb

    johannesQb

    Joined:
    Jan 18, 2022
    Posts:
    10
    Ok in build vSync works, but i don't understand why in unity editor play mode don't work

    Anyway, if I disable the vsync option in the game view, even if unity stats show only 60fps, the gpu load is 100%. If I enable vsync in game view option, the gpu load is 9/10% as expected.
    And it's not related to my project, I tried with a 2d demo platform game provided by unity hub, and i have teh same situation: even if a put Application.targetFrameRate = 60, if the vsync in game view option is disabled, the stats show 60fps but the gpu goes to 100% and overhating my computer.

    vsync.png
     
    Last edited: May 24, 2023
  7. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    Is this actually overheating your system? It can just be that the 100% is reported incorrectly
     
  8. johannesQb

    johannesQb

    Joined:
    Jan 18, 2022
    Posts:
    10
    Yes, actually overheating, I can feel it putting a finger on the laptop