Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How Unity3d Supports System.Numerics

Discussion in 'Windows' started by dreamCirno, May 16, 2018.

  1. dreamCirno

    dreamCirno

    Joined:
    May 16, 2018
    Posts:
    20
    0. Description:
    Thanks to the person who browsed this post, because my English is not very good, so this is a machine translation.

    1. 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)

    2. Code:



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

    3. 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.

    5. 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.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    You can find System.Numerics.dll and System.Numerics.Vectors.dll in <UnityInstallDir>\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:

    Code (csharp):
    1. -r:System.Numerics.dll -r:System.Numerics.Vectors.dll
    You should now be able to use APIs from them.
     
    dreamCirno likes this.
  3. dreamCirno

    dreamCirno

    Joined:
    May 16, 2018
    Posts:
    20
    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
    upload_2018-5-17_8-31-57.png

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

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

    What's wrong with my step?
     
  4. dreamCirno

    dreamCirno

    Joined:
    May 16, 2018
    Posts:
    20
    I really really thanks for your help!

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

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

    Thank you!
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    Well, you would have needed it if you put it next to Assets folder, instead of inside Assets folder :).