could you please provide information which version of Unity uses which version of Mono?
E.g., does Unity 2018.3 come with 5.16.0? Would be nice to be able to use the 32bit floating math and the Span with the intrinsics based implementation. Or will I have to wait for later versions of Unity?
There is not a direct mapping between Unity versions and Mono versions, since we pull the Mono source code and modify it. Unity does support specific .NET profile versions though. In Unity 2018.3, you can choose either .NET 4.7.1 or .NET Standard 2.0. Unfortunately Span is not available in either.
Sorry to hijack this thread but it seemed fitting, I’m currently trying to set up my codebase with the System.Memory package but when I run my code I get
System.IO.FileNotFoundException : Could not load file or assembly ‘System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies.
I’ve added the System.Memory.dll by using Nuget and afterwards copying the file from <ProjectRoot>Packages\System.Memory.4.5.1\lib\netstandard2.0\ to <ProjectRoot>\Assets\Libraries\
I noticed that one of the Unity Packages I installed is referencing a different System.Runtime.CompilerServices.Unsafe.dll:
It compiles, and i’m on latest VS 2019.
This machine is on Win7 though, if that makes any difference. ( Too old and specialized to switch to 10, but i have another machine that’s on 10 )
I also tried to make a fresh project, the former one was imported from an earlier version.
But that also doesn’t make Span<> show up.
TargetFramework seems to be set to 4.7.1 in that file.
I just installed 4.8 Developer Pack, and the DotNet 5.0 SDK, but making a new project still targets it at 4.7.1.
Changing that setting to 4.8 also does nothing it seems.
Not even sure what value is supposed to be there to make this work
I also can’t right-click on the Assembly-CSharp project to get to the properties, it just makes VS blink and never open the Properties window … lovely.
Oh well - it’s not that important right now. Don’t want to delve into some deep Microsoft Rabbit-Hole to get it working ( or learn that it’s yet again something that is now breaking because Win7 was abandoned ). I know too little about C# in general.
Extra : Setting the Target to 5.0 shows a “Download Targeting Pack” option, when used it loads an empty Bing Page. ( The Targeting Pack was actually installed with the DotNet 5.0 SDK - but apparently Visual Studio doesn’t “see” it somehow ? ) Thanks MS
Ok, it seems to work now, i just had to put “using System;” in the file to see it Yes, i’m stupid.
But finding a lot of “using System.Memory;” mentioned all over Google related to this also didn’t help.