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

Unity Player 80% CPU Usage

Discussion in 'Editor & General Support' started by hgokturk, Mar 19, 2020.

  1. hgokturk

    hgokturk

    Joined:
    Jun 29, 2016
    Posts:
    17
    Hey,
    Using Mac 10.15.3 & Unity 2019.3.5f1
    In a very simple scene which runs about 900 fps in Windows machine (16gb ram, i7), in my Mac it goes up to 100% usage of CPU, average 80%.
    Mac specs % profiler ss is here:
    https://imgur.com/a/8qtCfDF

    fps is set to 60.
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,160
    Looks like you'd be hitting those 60 fps if rendering the profiler window wasn't so expensive (those spikes) and if you where running this in a standalone build. The Editor is waiting for target FPS/vSync differently than a built Player, so you should be checking this there.
     
  3. hgokturk

    hgokturk

    Joined:
    Jun 29, 2016
    Posts:
    17
    i am hitting more than 60 fps. the problem is it takes more than 80% of CPU which isn't a normal scenario i guess.
    by the way i'm not following you. what is your recommendation?
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,160
    Make a build and profile that, see if it behaves the same.
     
  5. hgokturk

    hgokturk

    Joined:
    Jun 29, 2016
    Posts:
    17
    iPhone 6s Plus seems to run ok with ~50% CPU usage. Anyway, what causes Mac CPU load?:rolleyes:
     
  6. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,160
    I think on windows, waiting for the target fps in the editor actually means the thread is idling while waiting for a Semaphore.WaitForSignal. From the Profiler screenshot, it looks like the Mac doesn't do that Semaphore.WaitForSignal so I assume its waiting for the target fps while the main thread is still keeping the CPU busy.
     
  7. hgokturk

    hgokturk

    Joined:
    Jun 29, 2016
    Posts:
    17
    I see. Seems like there's no way to fix this issue. Then developing on Mac is pointless when i can get about 600fps on Windows.
     
  8. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,160
    If you're setting Application.targetFrameRate = 60 you should get 60 on Windows as well. Same with setting QualitySettings.vSyncCount =1 or the vSync toggle in the game view's resolution drop-down