Any number that exceeds 32 bits crashes game

I’ve tried using a long, I’ve tried using a double, I’ve even tried using an Int64, but if my number exceeds the 32-bit integer limit, my game crashes. I’ve tried debugging it but there are no crash logs appearing. I have literally removed every single reference to the number and only put it to equal like 5 billion on startup but it still crashes my game. Is there something I need to tweak in the player settings or how do I get rid of this issue?

Ok, just to clear some confusion here:

  • First of all the type long is just an alias for the type System.Int64. So they are literally the same type and there will be no difference using long or Int64.
  • The type long works even on 32bit architectures / operating systems. It is just a signed number type with 64 bits. Just like the type decimal which has 128 bits and works on 32bit hardware / software
  • setting a long variable to any kind of value will never crash or hang your application.

It’s not clear what you mean by crash. In most cases you do not experience a crash but a hang which is a quite different thing. If your application hangs in almost all cases you have some kind of infinite loop. Do not concentrate on the setting of the value but on where you use it.

We can’t help you any further without more information. All i can say i’ve used longs, and ulongs in 32 / 64 standalone build as well as android or webGL builds without any problems. And yes, my values did exceed the 32 bit border, otherwise i wouldn’t have used a long in the first place. So if you want further help edit your question and include your code.