Debug.Log - Displaying a hex value?

Hi

I’m trying to find out if it’s possible to display a value using Debug.Log as a hex value (eg, the same as using printf(“%x\n”,v);

I’ve searched around and can’t find anything. If that’s the case, is there an easy way to convert an int to a hex string (as in, a way that’s build into Unity) - Or do I have to write a converter myself?

Thanks
J

You can use:

Debug.Log(10.ToString("X"));

or:

Debug.Log(String.Format("{0:X}", 10));

Check the MSDN docs for formatting rules.