1

I do not understand why I get error on the line BigInteger a = new BigInteger(25);

This is my code:

using UnityEngine;
using System.Collections;
using System.Numerics;

public class Variabili : MonoBehaviour {

    BigInteger a = new BigInteger(25);

    public static ulong atomi;
    public static float tempoDiGIoco = 0;

    public static float metri = 0;
    public static float kilometri = 0;
    public static float anniluce = 0;

    public static float prestige = 1.00f;

}

enter image description here

  • 3
    If you type in `System.Numerics.` and wait for Intellisense to kick in, what suggestions do you get? – Jon Skeet Jul 02 '15 at 10:47
  • sorry but I don't understand what you're talking :). I would simply create a huge variable that can hold up to 10 ^ 50. and I saw on the internet that serves a BigInteger but I can not implement it –  Jul 02 '15 at 10:50
  • possible duplicate of [How to use BigInteger in VS 2010](http://stackoverflow.com/questions/4281858/how-to-use-biginteger-in-vs-2010) – JimiLoe Jul 02 '15 at 10:55
  • I'm suggesting that somewhere in your code, e.g. in a method, you type in `System.Numerics.` (including the trailing dot) and see what happens. Do you get any prompts? Do you currently have an error for your `using System.Numerics;` line? – Jon Skeet Jul 02 '15 at 10:57
  • happen this Assets/Scripts/Variabili.cs(3,14): error CS0234: The type or namespace name `Numerics' does not exist in the namespace `System'. Are you missing an assembly reference? –  Jul 02 '15 at 11:02
  • Nothing happens if you put a . after Numerics –  Jul 02 '15 at 11:05
  • You are then missing the reference to System.Numerics on your VS project. If you remove the big integer line form code, does the project compile (without removing the using clause)? – Nahuel Ianni Jul 02 '15 at 11:19
  • no. I get the same error –  Jul 02 '15 at 11:22

1 Answers1

3

You're using Mono version which is an equivalent of .NET 3.5, but the System.Numerics is available in .NET 4.0+ only.

I'm afraid that you have to add a third party library to your project.

Unity3d doesn't have BigInteger implementation.

This one: biginteger.codeplex.com should be fine.

Anton Sizikov
  • 9,105
  • 1
  • 28
  • 39