How Unity3d Supports System.Numerics

  1. Description:
    Thanks to the person who browsed this post, because my English is not very good, so this is a machine translation.

  2. The problem:

Platform: Unity3d 2017.3.1 Language: C#
Because the need to reference System.Numerics, Unity’s solution project does not support direct reference dll
So I’m from C: Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.6
Found under System.Numerics.dll import to Assets, there was an error. (I have chosen Script Runtime Version as .Net 4.6 in Edit - Project Settings - Player - Other Settings)

  1. Code:

You can see that the System.Numerics.BigInteger class can run, but this error dll seems to affect my other code.

  1. Error information:

4, Which methods have been tried:

I tried to put Assets in System.Numerics.dll using .Net 3.5.
It has not been resolved yet.

  1. Thanks

C: Program Files (x86)Reference AssembliesMicrosoftFramework.NETFramework

System.Numerics can be found in this directory. Interested ones can be imported into Unity to find the problem.

You can find System.Numerics.dll and System.Numerics.Vectors.dll in \Editor\Data\MonoBleedingEdge\lib\mono\4.5-api. Copy them to the root of your project (next to the Assets folder). Then, create 2 text files: mcs.rsp and csc.rsp. Put this inside of both of them:

-r:System.Numerics.dll -r:System.Numerics.Vectors.dll

You should now be able to use APIs from them.

1 Like

Thank you for reply!

But I only found System.Numerics.dll in C:\Program Files\Unity 2017.3.1f1 (64-bit)\Editor\Data\MonoBleedingEdge\lib\mono\4.5-api
3499751--278933--upload_2018-5-17_8-31-57.png

Then I created two files in my Unity Asset.
3499751--278934--upload_2018-5-17_8-33-25.png

But the error still there.
3499751--278936--upload_2018-5-17_8-34-41.png
3499751--278935--upload_2018-5-17_8-34-17.png

What’s wrong with my step?

I really really thanks for your help!

I found System.Numerics.dll and System.Numerics.Vectors.dll in
\Editor\Data\MonoBleedingEdge\lib\mono\4.5
not in
\Editor\Data\MonoBleedingEdge\lib\mono\4.5-api

It seems does not need to created msc.rsp and csc.rsp

Thank you!

Well, you would have needed it if you put it next to Assets folder, instead of inside Assets folder :).