Search Unity

Unity build runs absurdly slow on MacOS, even with NOTHING in the game, not even a skybox.

Discussion in 'macOS' started by UmaroXP, Jan 9, 2021.

  1. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    I can't for the life of me figure out why I'm getting such atrociously bad performance. I'll create an empty project, remove the skybox, add nothing except for a custom FPS counter which is very lightweight and has worked fine on games I've built on PC, and when I run the game in editor I max out at 38fps. If I build the game I can almost get 60fps, but once I start adding literally anything it tanks.

    MacOS 10.14.6 (Mojave)
    2018 MacMini
    3.2Ghz 6-core CPU
    64GB Ram

    I've tried Unity versions:
    2019.1.8f1,
    2019.4.16f1,
    2020.2.1f1

    ...And the result is the same on all of them. I don't think it's a hardware problem, as I can run games built with Unity, like Hearthstone, and get 60fps no problem. Someone suggested it has something to do with "Metal" but I've tried with and without it and it doesn't make a difference.

    The profiler claims the bottleneck is Semaphore.WaitForSignal which implies it's a GPU issue but Vsync is off, I mean the project is EMPTY, and I've never had any GPU problems on this machine while running other games.

    I have recently completed a game made on Windows which never drops a frame, but if I transfer the project to MacOS and open it in Unity I can't get above 11fps. I've tried exporting said game as a MacOS build and transferring it to the Mac but it simply refuses to run, regardless of whatever "chmod" bullshit I try.

    I'm beyond frustrated with this. Does anyone have any ideas on this?

    Stephen
     
    Last edited: Jan 10, 2021
    john246810 and arendhil like this.
  2. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    If macOS refuses to run it because it's been downloaded from the internet, it could be the same problem I'm also facing. Seems to be a signing issue. In case you're interested in that, theres two threads about that:
    https://forum.unity.com/threads/code-signing-for-bundles-dylibs-inside-app.1034230/
    https://forum.unity.com/threads/osx-code-signing.455830/

    About the bad performance.. I've also seen that with the URP template recently, but it doesn't happen in my main project, so I'm sorry I can't help you there.
     
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Good point about the rendering pipeline, though. I'm not seeing such performance problems in my projects either, but even in an empty project, you have already chosen a pipeline... @UmaroXP which one(s) have you tried?
     
  4. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    I've only tried URP and a legacy project with LWRP which is allegedly the same thing but who really knows.

    I'll try HDRP but I was really hoping to use the Mac to develop for iOS so it may be pointless.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    What's your GPU usage look like? Is anything else running on the machine that could possibly be using up the GPU resources?
     
  6. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    If I open Activity Monitor and pull up the GPU History window, when I run my empty scene (which consistently maxes out at 38fps), the GPU History window shows it's almost maxed, like more than 90%. If I run my finished game, which is actually very lightweight compared to modern titles, the GPU is completely squished at 100% and my framerate is around 11.

    With Unity closed, it hardly even registers. With it open but not running the game it sits at around 10%-ish.

    I ran a game of Hearthstone to see how it compares, and it peaked around 95%-ish with average around 80%, but it was running on max settings and getting a smooth 60fps.

    As a build, the empty scene gets up to 60fps, though inconsistent and the gpu still pushes 80%. Screenshot attached.
    Screen Shot 2021-01-11 at 6.19.36 PM.png
     
  7. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    For what it's worth, I don't use URP, HDRP, or LWP. I use the standard (legacy?) rendering pipeline. And my projects seem to perform just fine. Chances are those other Mac games you reference are also using the standard pipeline. Maybe you should try that?
     
  8. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    I just opened the "Sample Scene" HDRP thing, you know that sort of half finished construction site sitting in an empty void. It ran just as terrible, maybe getting 20fps, and also Unity itself was running super slow.
     
  9. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Yes. HDRP is junk. But what about the standard pipeline?
     
  10. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    Result is the same.

    The plot thickens, however. I've made an iOS version of my game, using Unity in Windows, exported the xcode project to the mac and side-loaded it onto my iPad and it runs very consistently at 120fps. So I don't think my game is the problem.
     
  11. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    Tautvydas-Zilys do you have any insights as to why I'm getting such terrible performance on Mac? I just updated to the newest MacOS and it didn't change anything.
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    I've no idea. What resolution are you running at? Did you try using the profiler? Any chance your mac is overheating?
     
  13. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    Resolution is 2560 x 1440. Profiler says the bottleneck is Semaphore.waitforsignal.

    it’s not impossible that the Mac is overheating but unlikely. It’s only a couple months old and the results are the same even if I try right after booting up in the morning and it’s only 60 degrees in the room.
     
  14. jazzay22

    jazzay22

    Joined:
    Oct 17, 2017
    Posts:
    32
    I am seeing a similar issue. I have reproduced this in a very simple project with a couple dozen static Cubes.
    Unity 2020.2.2f1, MacBook Pro 2015.

    Majority of frame is spent waiting for Present.
    Looking at the Render thread it is spending most time inside Camera.ImageEffects ... PrepareRenderTarget.

    Here's screenshot of Profiler where you can see it takes 32 ms on render thread:
    upload_2021-1-25_20-13-43.png

    I have not tried older versions of Unity yet, but sounds like it happens there as well.

    My hardware spec:
    upload_2021-1-25_20-18-20.png

    Can we get this looked at asap? Happy to send over my project if that helps.
     
  15. jazzay22

    jazzay22

    Joined:
    Oct 17, 2017
    Posts:
    32
    Here I did a capture with XCode Instruments, within another test where Camera.ImageEffects takes significant amount each frame. You can see below a few frames in sequence.
    upload_2021-1-25_21-22-52.png

    @Tautvydas-Zilys let me know if there is any additional information I should grab.
     
  16. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    Can you report a bug on this? If you could work with our QA to get them to reproduce this, then we would be able to investigate what's going on here.
     
    MartinTilo likes this.
  17. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    @jazzay22 if anything good comes from that bug report could you let us know here too?
     
    siwalu, john246810 and arendhil like this.
  18. ninomusic

    ninomusic

    Joined:
    Feb 21, 2021
    Posts:
    1
    Hi guys. I'm running the 3d Game Kit on a Macbook pro 2015 retina with i7 and 16gb of ram, graphic card integrated. It's impossible to work on it. How do you have solved the problem with Mac? Too slow! I must solve that...
    Thank you to the one is going help me.
     
  19. Rebaken-Enterprises

    Rebaken-Enterprises

    Joined:
    Nov 17, 2014
    Posts:
    17
    Want to follow this thread. I'm seeing disaster on Mac. Runs fine in the editor, but a build is just brutally slow. Set the default settings down to "High" and it's better, but still so slow and eventually just grinds to a halt. I've been testing builds on WebGL and itch.io and it runs fine there.
     
  20. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    I don't think we have any known issues. Did you try using the profiler?
     
  21. ZurielA

    ZurielA

    Joined:
    Oct 19, 2021
    Posts:
    11
    I just started developing in Unity myself and i've been on a PC with 3080 GPU. ran the mac a few times no big deal, even coded some stuff in the editor. my PC blew up and i am waiting on replacement parts and so i've been exclusively on my macbook while I am waiting for the replacements. its a i9 macbook pro with 32 gb ram, so, although its not a 3080 RTX, it still should load up a barely indie iOS 3D game and run it fine but it doesn't the FPS shows 300 on my FPS counter but it spikes up to well over 100% CPU, so hard that you can't quit and if you try you are at 1 FPS on mac OS, its kernel level CPU halting power... i left it for 30 seconds and my mac finder crashed and popped up a recovery. so its something. I also am getting Semaphore wait for GPU = Mac OS Big Sur 11.6 -
     
  22. skwoods98

    skwoods98

    Joined:
    Mar 18, 2019
    Posts:
    7
    Same thing here - URP building to WebGL on multiple modern Macs with retina displays. Fine anywhere else. Has anyone tried the 2022 Unity version to see if that fixed it?
     
  23. ZurielA

    ZurielA

    Joined:
    Oct 19, 2021
    Posts:
    11
    i swapped to open GL to run the GPU profiler and I found that the macs GPU just couldn't keep up with something I threw at it (maybe memory issues or something) but basically dropping everything down to super low levels I eventually got it to run a good 40 - 60 fps. I just think there was, or is, something in my game that doesn't like the mac, that or its just above the performance req's for mac and without any optimization, unity doesn't know what to do with it and just tries to run and it can't
     
  24. Rebaken-Enterprises

    Rebaken-Enterprises

    Joined:
    Nov 17, 2014
    Posts:
    17
    I'm hoping 2022 does something. 2021.2 I have a project going now and we just decided to not support Mac, they can run it through WebGL. Works great on Android. Oh no, just thought about iOS, hopefully that's not an issue. That's 3 projects so far I can't run on Mac. (That said, I haven't explored too deep either, just monitoring this thread :D )
     
  25. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    It's unlikely random engine upgrades will magically fix major performance issues in your game. I suggest using a profiler to figure out why it's running slow and address it within your project.
     
  26. Rebaken-Enterprises

    Rebaken-Enterprises

    Joined:
    Nov 17, 2014
    Posts:
    17
    I can just make a single UI Animation and it's slow. All my projects are slow on Mac on multiple machines. A random engine upgrade magically broke them, why wouldn't it fix them :D
     
  27. alejandrorak2

    alejandrorak2

    Joined:
    Jun 29, 2019
    Posts:
    4
    Also producing the same results on mac, its ridiculously slow.
     
  28. BitmenStudios

    BitmenStudios

    Joined:
    Mar 30, 2013
    Posts:
    2
    Same here, I am using HDRP. Windows builds are totally find but Mac builds are unplayable.
    I don‘t think optimizing the game will fix it as it can barely handle an empty scene or even the Unity HDRP sample project.
     
  29. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi, I get the same here, pulling what's left of my hairs... how come it performs totally fine on Unity Editor on the very same machine I build for... the built version has dramatic stutter...

    Bye,

    Jean
     
  30. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    If you think the problem is within Unity, please report a bug! My point was that we cannot fix what we don't know about if the issue is within the engine.

    That is generally caused by the game view resolution in the editor being much lower than running it in fullscreen in the build. You can test that theory by making the resolutions the same.
     
  31. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    hi,

    Very good point on the editor resolution less than the final build, this helped me figure it out! thanks :) I kind of intuitively knew it was not a bug, but could not pin point the issue exactly.

    Bye,

    Jean
     
  32. Enlumis

    Enlumis

    Joined:
    Dec 28, 2015
    Posts:
    3
    Hi,
    I got the same issue..
    This is frustrating i just converted my whole project to the URP to find out that i cannot build a macos game with URP
    Even the most simple scene is slow like if it was running 3 instances of GTA V... Even got kernel panic screen if i let it run for too long.

    Android fine
    Windows fine
    Linux fine
    Macos sickening

    I have not got to debugging yet, because i have no editor on my mac, i only use it for testing..
    This is insane, it is not about the mac running crap in background or lack of hardware (RAM, disk) or about the game implementation its about URP and macos standalone builds for sure, why would it work perfectly on other platform ?

    Im running Unity 2021.3.4f1
     
  33. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    @Tautvydas-Zilys

    I'm having the exact same issue, on two different macs. Sadly it is hard to file a bug report other than "GPU runs at full" because it happens even in an empty scene. Here is my set up and the result, using an empty scene in SRP (no other software open):

    Intel Mac Mini + eGPU Radeon Vega
    Intel Macbook Air

    Unity 2019 LTS = no issues

    Unity 2020 LTS Metal API = fans run at full on both machines, in editor and in mac builds. Frame rate is very low.

    Unity 2020 LTS OpenGL = no issues

    Unity 2021 LTS Metal & OpenGL = Unity locks up OSX and crashes after a few minutes running.

    The issue may be related to this known bug: https://issuetracker.unity3d.com/is...ngfxthread-5-10ms-spikes-when-using-metal-api

    It is especially concerning because right now the only stable LTS on Mac is Unity 2019, which is being retired this month (June 2022)
     
  34. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi, I think it's the wrong thread, you seem to indicate that the building time is hal f an hour, this thread is about the FPS when the game is playing.

    Bye,

    Jean
     
    RendergonPolygons likes this.
  35. Sigono-Unity4

    Sigono-Unity4

    Joined:
    Aug 27, 2020
    Posts:
    11
    Hi, any follow up to this problem? We use URP for our new project, and when creating standalone builds, the MacOS build is atrociously slow on Intel Macs (it runs fine on Apple Silicon Macs, but there we have a random crash). The Windows build has no such issues.

    Using Unity 2021.3.19f1

    I am talking 20 to 30 seconds per frames (yes, not frames per seconds), running for about a minute locking the entire system, then the Macbook restarts.

    In this state I can't even realistically run a profiler to see what's up. It only happens in our most advanced/polished scene so far. It seems our greyboxed or simpler/prototype scenes are fine.

    Interestingly, the project itself, including the problematic scene, run fine (at least somewhere around 20fps) when run from the Editor, so only the Standalone MacOS build is affected (on Intel Macs).
     
    Last edited: Apr 21, 2023
  36. gotchipete

    gotchipete

    Joined:
    Sep 16, 2023
    Posts:
    6
    -exact-same symptoms here. Have you found any solution?
     
  37. Hiep87

    Hiep87

    Joined:
    Nov 1, 2022
    Posts:
    1
    webGL bad for MAC