- Home /
Unity API not supporting longs (64 bit int)?
Hi all, I would like to use longs in my game, but I'm running into trouble when I try to use it with the Unity API.
For instance Mathf.RoundToLong() doesn't exist and neither does PlayerPrefs.SetLong().
My game requires for me to work with values that exceeds int.MaxValue, hence the dilemma.
Is there anyone here who can shed some light on this, and maybe point me towards a best practice on working with 64 bit ints in Unity?
Thanks!
Answer by KevLoughrey · Apr 18, 2014 at 08:59 PM
Does Convert.ToInt64() work by any chance?
Edit: I'm too used to C#. It never occurred to me that you might be working in Java. Try Long.valueOf() if you're using Java.
Answer by landon912 · Apr 20, 2014 at 10:25 PM
You can make a new custom class and have it inherit from Mathf. Then impliment the long methods. The same with PlayerPrefs.
Your answer
Follow this Question
Related Questions
how i can save big text files in web player? 1 Answer
Unity keeps crashing and I dont know why 1 Answer
Logic and datatype existential problem 2 Answers
Joystick.cs Invisible 1 Answer
Custom Datatypes for optimization? 3 Answers