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

BigInteger in Unity

Discussion in 'Scripting' started by Jymmy097, Oct 8, 2014.

  1. Jymmy097

    Jymmy097

    Joined:
    Jul 7, 2014
    Posts:
    67
    Hi everybody,

    I know there is an implementation of BigInteger in the System.Numerics assembly of .NET 4.
    I need to use them inside my Unity project, but I cannot import the assembly in my project. If I use the instruction using, the compiler throws an error telling me it cannot find the assembly. So I looked up the directory of the System.Numerics.dll file and added it to my Unity project, but Unity itself throws two errors in the console.

    My question is: is there a way to include this assembly (this was added in C# 4 and .NET4) or have I to find a Unity implementation for it?

    Thanks in advance.

    Jymmy097
     
  2. RazorCut

    RazorCut

    Joined:
    May 7, 2009
    Posts:
    393
    Can you not just use 'long' or 'ulong'?
     
  3. Jymmy097

    Jymmy097

    Joined:
    Jul 7, 2014
    Posts:
    67
    Well, I do not think they are able to manage the high numbers I need... :(
    I have already thought if there was an alternative, but I need BigIntegers because I do need precision.

    Jymmy097
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,738
    Keep in mind (I suspect this is the source of your problem) that Unity uses Mono, and not .NET. Mono probably does not have this class implemented.
     
  5. cranky

    cranky

    Joined:
    Jun 11, 2014
    Posts:
    180
    Try using something like dotPeek to crack open the assembly and recreate it from scratch.
     
  6. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    Your number has to go beyond –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807?
     
    landon912 likes this.
  7. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
  8. Jymmy097

    Jymmy097

    Joined:
    Jul 7, 2014
    Posts:
    67
    Ok, Thanks a lot!

    I've solved. I splitted up the space into "small" cubes so I do not need BigIntegers anymore... I'll use longs... Thanks a lot!!

    Jymmy097