Search Unity

Unity on Apple silicon and Big Sur: Known issues and workarounds

Discussion in 'macOS' started by Tautvydas-Zilys, Jul 10, 2020.

  1. sergioabril

    sergioabril

    Joined:
    Jan 11, 2016
    Posts:
    33
    Automatic rejection due to some signature problems. It could well be my mistake while signing it tho, but I'm following this guide, and when the binary is built using Mono, it's accepted by the App Store with no extra step (just Unity's delivery manual):


    Code (Boo):
    1.  
    2. ITMS-90238: Invalid Signature - The executable at path Starman.app/Contents/Resources/Data/ARM64/GameAssembly.dylib has following signing error(s): valid on disk /Volumes/data01/app_data/awf/mz_12928241822325705445dir/mz_3404187745139814872dir/games.nadastudio.mac.starman.pkg/Payload/Starman.app/Contents/Resources/Data/ARM64/GameAssembly.dylib: satisfies its Designated Requirement test-requirement: code failed to satisfy specified code requirement(s) . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.
    3.  
    4. ITMS-90238: Invalid Signature - The executable at path Starman.app/Contents/Resources/Data/x64/GameAssembly.dylib has following signing error(s): code object is not signed at all In architecture: x86_64 . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.
     
  2. sergioabril

    sergioabril

    Joined:
    Jan 11, 2016
    Posts:
    33
    It definitely helped me, thank you so much.
    I used a similar process. However, instead of changing the Game Assembly Script, I just changed the Build Legacy System to the new one (On Xcode, File / Project Settings).

    It also worked for release builds, but I had to add the entitlements manually, and also manually codesign every Plugin Bundle I had (which apparently didn't get signed in the process of building from Unity)
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Unfortunately this change had to be backed out of 2020.2.0b12 because it caused some issues in the editor. Still looking into it but hoping it can land soon again.
     
  4. vpacha

    vpacha

    Joined:
    Sep 11, 2012
    Posts:
    3
    Hello everyone, need some help here, I need to buy a new MacBook for Mobile development (iOS and Android) should I buy the silicon one or will I have problem with compatibility issues?
    Thank you, I really appreciate the experience from the ones who got the Arm Kit
     
  5. thestringer

    thestringer

    Joined:
    Aug 7, 2014
    Posts:
    70
    Good question, RC2 on DTK and Unity just hangs on any window now. It may be a DTK only issue or a Unity one, Makes me wonder how Apple demo'd the Boat demo on Silicon in the promo video as I could not get it running 100% on older versions of Big Sur.

    I would like to think the shipping M1 kit work out of the box.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    It's a bug in macOS Window Server. We've been working with Apple to figure out a workaround we can apply on Unity's side and we found one just last week. We don't yet know which macOS build will fix it but we're landing our fix to all Unity releases so you could use them on the DTK and new devices (if they happen to exhibit the same behaviour) as soon as possible.
     
    Klausology and thestringer like this.
  7. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    Rosetta 2 is a translation layer, not an emulation layer. On Unity first run, macos will create a translated cache. I don't know the details of course but this has been pointed out by other devs. Not ideal, but still better than real-time emulation.
     
    AlejMC likes this.
  8. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    In the current state Unity 2020.2.0b11 is unusable on DTK.
    - Editor constantly has screen freezes (monitor on/off gets the issue resolved)
    - Built project has absolute screen freezes - monitor on/off only advances it to the latest frame.

    Which version are the workarounds expected to land to?
     
  9. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    This issue is being discussed here: https://forum.unity.com/threads/mac...20-2-0b6-freezing-screen.988352/#post-6424331

    Working with animation window will also cause unity to freeze. Issue tracker has already been filed : https://issuetracker.unity3d.com/product/unity/issues/guid/1278810
     
  10. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
  11. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    So, all existing Unity games built using Mono simply don't work on M1?
     
  12. WG3D

    WG3D

    Joined:
    Sep 26, 2013
    Posts:
    2
    I'm getting this error every time I quit Unity.
    Screen Shot 2020-11-14 at 12.20.24 PM.png
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    No, only new builds made from 2020.2 beta targeting native Apple silicon.
     
  14. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    You can workaround the build project issue by not disabling VSync.
     
    Dmitry-Pyalov likes this.
  15. Gord10

    Gord10

    Joined:
    Mar 27, 2013
    Posts:
    142
    So it means that Rosetta 2 can't translate old Unity games, am I right? As someone who has been using Unity 2018 on a rather big project, I hope I can get my game work on new Macs without upgrading to Unity 2020.
     
  16. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Seems games built with IL2CPP do work, but it would be nice to have confirmation. I suppose Mono and other JIT-based solutions, which generate machine code at runtime, are too much for Rosetta 2, and Apple has a tradition of not caring much about making exisiting apps work in their new OSes, placing the burden on developers to go back and update their apps.
     
  17. fullerfusion

    fullerfusion

    Joined:
    Dec 2, 2018
    Posts:
    22
    Hi everyone, I've run into an issue after I updated my Macbook Pro OS from Catalina to Big Sur:

    I'm currently using Unity.2019 4.10.14LTS and VFX Graph 7.5.1. I have a Procedular skybox shader in my scene that isn't running properly anymore since the new OS update. I have a [ExecuteAlways] tag so my skybox system will update in real-time so whenever I make changes to inspector it changes in edit mode. However, my Scene and Game Windows(hopefully that's the correct term)aren't updating, they appear frozen, unresponsive, and causes the text in Unity to be unreadable and jumble up. There are no error messages in my console. Whenever I open up Unity with VFX graph installed I see these warning messages in my console:

    Code (CSharp):
    1.  
    2. Metal: Compute shader (Sort.BitonicSort4096) has 1024 threads in a threadgroup which is more than the supported max of 512 in this device
    3.  
    4. Metal: Compute shader (Sort.BitonicPrePass) has 1024 threads in a threadgroup which is more than the supported max of 512 in this device
    5.  
    6.  
    When I double click on the any of the warning messages, Visual Studio will load up but it doesn't take me to any shader I have. So, I don't know where that issue came from? So, that's my issue. I'm not sure how this issue happened in the first place because this never happened in my previous OS of 10.13 Catalina. I probably shouldn't have update my OS.
     
  18. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    quick question: so if cant switch between my desktop pc (windows, intel) and potential laptop macbook air m1 even if the project is on 2020.2beta?

    or if someone on the team got a intel mac and the other one a m1 mac
     
  19. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    No not at all. Sorry for the confusion, I should have elaborated it. All old games work well under Rosetta 2, both using Mono and IL2CPP scripting backend. The issue only affected games that were targeting Apple silicon natively.

    Please report a bug.

    I don't quite understand what you're asking. You can open your Unity project on whatever machine you want if that's what you're wondering.

    JIT works fine under Rosetta 2. If it didn't Unity editor wouldn't work at all.
     
    protopop likes this.
  20. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    Do we have any means of detecting that this is an ARM build?
    The first thing that comes into my head is using __aarch64__ define in a native plugin.
    Is there any other way?
     
  21. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    That's a relief. The way it's written in the OP didn't make it clear the problem was only with ARM players.
     
  22. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    That is probably the easiest option.
     
  23. Gord10

    Gord10

    Joined:
    Mar 27, 2013
    Posts:
    142
    Thank you for letting us know! I'm glad to hear it.
     
  24. aurelienk

    aurelienk

    Joined:
    May 19, 2015
    Posts:
    2
    Hello,

    Specs:
    - Apple Development Platform, Apple A12Z Bionic
    - macOS Big Sur 11.0.1 (20B29)
    - Unity 2018.4.29f1

    First I need to use the -noUpm command line arg in order to be able to start Unity, otherwise the Editor warns about firewall policies.
    Then I create a new blank project and create a new blank script.
    Unity fails compiling the script, both in standard/batchmode, with error:
    Failed to initialize CoreCLR, HRESULT: 0x80004005

    Is there something I need to install/configure?
    Thanks.

    Here's the log:
    [...]
    "Assets/NewBehaviourScript.cs"
    -----CompilerOutput:-stdout--exitcode: 137--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
    -----CompilerOutput:-stderr----------
    Failed to initialize CoreCLR, HRESULT: 0x80004005
    -----EndCompilerOutput---------------
    - Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll
    [...]
    Aborting batchmode due to failure:
    Scripts have compiler errors.
     
  25. LangTao92

    LangTao92

    Joined:
    May 13, 2017
    Posts:
    15
    I have a new macbookpro M1 with mac OS 11.0.1 machine,how can i support 2019.4 LTS Unity develop? Only can use 2020.2 beta?
     
  26. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Can we get a bug report on this?

    You should be able to run Unity 2019.4 editor. Does it not work?
     
  27. appymedia

    appymedia

    Joined:
    May 22, 2013
    Posts:
    95
    Hi @Tautvydas-Zilys (or any Unity team member that knows :)),

    Just looking for a little clarification please. Does the above mean Unity 2019.4 editor is running problem free through Rosetta 2 on the new M1's? Assuming the same for the Unity player through Rosetta as well if so?

    I'm thinking of upgrading my 6 year old MacBook Pro and don't mind waiting for a native M1 build but I just wanted to know what the situation is if you install Unity and use it through Rosetta 2 right now for editor and player.

    Cheers!
     
  28. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    I don't know for sure, none of us have received the new hardware yet. But we aim to fix any issues that arise if they arise.
     
    appymedia likes this.
  29. appymedia

    appymedia

    Joined:
    May 22, 2013
    Posts:
    95
    Thanks, wasn't sure if Unity might have had some access to M1's. So the issues and fixes I see at the start of the thread are all based on the Apple Developer Transition Kit and might not be issues on the retail kit (thinking positive ;))
     
  30. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    We're not sure about the hang issue but I'm pretty sure that Mono scripting backend issue when targeting native Apple silicon player on 2020.2 will still reproduce on the actual hardware.
     
    Last edited: Nov 17, 2020
  31. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Update: I don't know exactly what's going on yet. However, I have a workaround: backup original Unity.app/Contents/Tools/Roslyn in your Unity 2018.4 installation, delete it and copy it from 2020.2 beta. Seems to fix it for me.

    But please please please report a bug or we run the risk of it getting lost since I'm juggling quite a few of these issues.
     
  32. appymedia

    appymedia

    Joined:
    May 22, 2013
    Posts:
    95
    Understand, I did imagine I was being a bit optimistic :) Hopefully you guys will sort any issues as quick as possible, keep up the good work.
     
  33. aurelienk

    aurelienk

    Joined:
    May 19, 2015
    Posts:
    2
    1.
    Thanks for your prompt support!
    I confirm your suggested workaround works.
    I reported a bug for this issue.

    2.
    However loading a full project won't work as launching the Editor with -noUpm prevent Unity from retrieving the required packages, then compiling fails on missing dependencies.
    Without the noUpm arg, Unity won't launch displaying the Unity Package Manager Error window: Failed to start the Unity Package Manager local server process. Make sure the process [...] is not blocked by your anti-virus configuration.
    I reported a bug for this issue.
     
  34. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    M1 Mac mini here, Big Sur 11.0.1, Unity 2020.2b11, I've not had any editor hangs :)

    Regarding builds, a lot of my crashes involve EXC_BAD_ACCESS (Code Signature Invalid) when I target Apple Silicon, and I am years out of date with macOS code signing requirements so I don't yet know if its just down to me doing something wrong. I can build for Apple silicon using IL2CPP and with the Development Build flag ticked and then I get builds that run ok!
     
  35. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Only editor issue I've run into on that machine so far is that arrow keys are blocked when using things like text fields for filename in save as dialog boxes. But since I wasn't using Unity on Mac very much until I got the new Mac mini, I don't know if that was an existing issue not relating to M1 specifically.
     
  36. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I can also confirm that I can build mono stuff targeting Apple Silicon using 2021.1 alpha 5 just like the release notes for that alpha indicate.

    However I still get code signing crashes like the following one when building for apple silicon with either mono or IL2CPP unless I tick the development build option. And I haven't gotten my head around whether this is expected behaviour or not, it doesn't do it if I build for Intel x64. Maybe I will see if I can disable System Integrity Protection on my Mac.

    System Integrity Protection: enabled

    Crashed Thread: Unknown

    Exception Type: EXC_BAD_ACCESS (Code Signature Invalid)
    Exception Codes: 0x0000000000000032, 0x000000010481c000
    Exception Note: EXC_CORPSE_NOTIFY

    Termination Reason: Namespace CODESIGNING, Code 0x2
     
  37. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Yes native Apple silicon builds with Mono scripting backend are not functional right now unfortunately. We had the fix for 2020.2.0b12 but had to back it out as it broke some other stuff. Currently working on getting that fix in, hopefully today. See known issues in the original post.
     
    Lars-Steenhoff likes this.
  38. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    That isn't what I'm saying though.

    I'm saying that mono builds do work using 2021.1 alpha 5 targeting apple silicon, using a M1 Mac mini, but only if I tick development build. And apple silicon builds targeting IL2CPP also crash if I dont tick development build. So I suspect that I am reporting an issue has been fixed in 2021.1, but there are other code signing issues that make non-dev mono and IL2CPP builds fail when targeting apple silicon (but they work if compiled for intel 64 on the same M1 Mac mini)

    The release notes for 2021.1 alpha 5 say the following, and you haven't mentioned whether the fix was also pulled from that version (in which case the release notes are wrong):

    Scripting: Fixed macOS Standalone player built for Apple silicon architecture crashing on startup with Mono scripting backend when running on macOS Big Sur Beta 6 or later. (1278359)
    • This has already been backported to older releases and will not be mentioned in final notes.
     
  39. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    And just to be completely clear:

    2020.2 beta 11:

    Mono Intel = OK
    Mono Intel Development Build = OK
    IL2CPP Intel = OK
    IL2CPP Intel Development Build = OK
    Mono Apple Silicon = Crash
    Mono Apple Silicon Development Build = Crash
    IL2CPP Apple Silicon = Crash
    IL2CPP Apple Silicon Development Build = OK

    2021.1 alpha 5:

    Mono Intel = OK
    Mono Intel Development Build = OK
    IL2CPP Intel = OK
    IL2CPP Intel Development Build = OK
    Mono Apple Silicon = Crash
    Mono Apple Silicon Development Build = OK
    IL2CPP Apple Silicon = Crash
    IL2CPP Apple Silicon Development Build = OK

    Where the ones written above in bold demonstrate a difference between 2020.2 and latest 2021.1 alpha, making me think that the mono fix did make it into 2021.1 alpha 5 as per its release notes.

    The underlined ones in red above represent probably a different/new issue (or me not understanding code signing requirements on macOS but only for apple silicon apps, since intel builds of same project still run).

    Tests conducted with fresh 3D template projects and default scene.
     
  40. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Yes, sorry, I didn't realize you were already on 2021.1. Mono fix did make it into that as you noticed in the release notes.

    Thanks for bringing up the non-development builds crashing. I'm not sure what's going on there but we will take a look.

    Out of curiosity: are you making the build from the editor on the same machine, or are you transferring builds from another machine?
     
    elbows likes this.
  41. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    (╯°□°)╯︵ ┻━┻ these Apple silicon signing requirements are driving me insane. Basically when you build the binary, the linker is supposed to automatically sign it, however, if you run any other tool on it, the signature is invalidated and the resulting builds may stop working (the bolded part is important because they didn't on some Big Sur betas so we missed it). Once that happens, we need to sign the binary manually again. What seems to have happened with non-development builds is that we do one additional step: we strip out debug symbols and that makes the signature invalid.

    I will make sure we fix it but in the mean time you can work around it by signing all binaries in <game.app>/Contents/MacOS/* and <game.app>/Contents/Frameworks/* manually using "codesign -s - -f <path>".

    I created a bug for this issue (might take a few hours to appear in the issue tracker): https://issuetracker.unity3d.com/product/unity/issues/guid/1293633/
     
    elbows likes this.
  42. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Thanks very much for finding the problem, for the explanation and very much for the workaround, I can confirm that worked for me thanks very much. And sorry to hear that this side of things has been giving you grief!
     
  43. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    171
    We're having a super weird issue on final Apple Silicon (Mac mini M1), that we were not experiencing on the DTK.

    On a game that we're working on, our frame rate hovers a little over 29fps, but never hit stable 30fps. The weird thing is that we were able to run at stable 30fps on the DTK by dropping the Render Scale, while on the M1 the frame rate is not affected in any way by it.

    The exact same game, with the same exact settings, runs at locked 30fps on iPhones and iPads.
    We're using V-Sync, we're not limiting the frame rate in any other way on Apple Silicon.
    We're on Unity 2020.2.0b10 + URP 10.1.0.

    We still have to profile properly on Apple Silicon, but it's very weird since we're not experiencing it on all other Apple platforms and we were definitely not experiencing it on the DTK.

    Any idea? :)
     
  44. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Wild guess: is your display configured to 29.97 Hz refresh rate by any chance?
     
  45. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    171
    Not so wild, but I’ve just checked and we’re running at 60hz. :/
     
  46. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    That was the only thing I could think of :(. Try a totally empty project in Unity and see if it behaves the same. If it does, it means the problem isn't related to your project. If it doesn't, then I would suggest profiling your game. Perhaps some operation is unexpectedly expensive on it?
     
  47. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    171
    Ok this is interesting: if we remove VSync, we're getting over 50fps constantly, with the same visual settings, on the Mac mini M1.
    But the maximum frame rate we can hit is around 57fps: we can't go up to 60 in any way.
    So we should definitely be able to hit constant 30fps while VSyncing.

    We're rendering at full native 4K resolution, dropping the render scale only to test performances (rendering at full 4K we get around 50 / 52FPS, dropping the render scale to 0.8 or lower we hit the maximum of 57fps and we're unable to go higher than that).

    It's very weird, we definitely had not this kind of behaviour while working on the DTK while connected to the same output, we just swapped the DTK with the new mini.
     
  48. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Does the profiler shed any light as to what's happening?
     
  49. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    171
    I’ll be able to profile it tomorrow. At the same time I’ll try to understand if there’s something strange going on with the display, since it seems tied to not being able to refresh at 30hz or 60hz correctly.
     
  50. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    184
    I've been running into an issue with the 2019.4.15 editor (and 2019.4.14) and the latest Big Sur 11.0.1 on an M1 MacBook Air.

    The issue is that sometimes, the screen completely freezes. That is, the image on the screen freezes. You can't move the mouse, you can't close the lid (screen stays on). The game however is still running since audio works as expected.

    It looks like it gets triggered mostly when the game is in play mode and I try to adjust the game view resolution. It also seems to happen randomly. On game view resolution change, it seems to happen around 5-10% of the time.

    The system is not frozen as I can still hear the game running and still play the game by ear. However, the screen is frozen. Any ideas? Is this just an Apple Silicon gpu driver issue? Happy to help debug this.