Search Unity

.NET 4.x in 2021.2 (on Apple Silicon)

Discussion in 'iOS and tvOS' started by ryanmillerca, Jan 13, 2022.

  1. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143
    Hey there, I have some code that relies on AOT generation and requires .NET 4.x. I can't seem to make an iOS build compile in XCode with .NET 4.x support using 2021.2.6 on an M1 machine. I've tried both Intel and Apple Silicion versions of the editor.

    When I open up 2020.3 LTS, it shows .NET 4.x and .NET Standard 2.0 as Api Compatibility Levels options in Build Settings. However, opening the project in 2021.2.6 only shows .NET Framework and .NET Standard 2.1. I can't see the version of .NET framework but I suspect it's 3.5 because it's causing AOT errors.

    Is there something I'm missing, perhaps a change in my configuration? I would expect newer versions of Unity to support higher levels of .NET if anything.

    Thanks.
     
    Last edited: Jan 14, 2022
    ffxiangyu likes this.
  2. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143
    Perhaps the title is not straightforward enough, but I'm truly looking for an answer to why .NET 4.x is supported on iOS in Version 2020.3 but not in 2021.2. Would love to get a response from someone familiar with the reasoning. Thank you!
     
  3. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
    In 2021.2, The ".NET Framework" option equates to .NET Framework 4.8, with some additional API only found in .NET Standard 2.1.
     
  4. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143
    Oh I did not know that, thank you! How did you discover this? I couldn't find it documented anywhere.
     
  5. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
  6. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143