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?


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.

You can make a new custom class and have it inherit from Mathf. Then impliment the long methods. The same with PlayerPrefs.