parseInt not supported

Would I be right in thinking parseInt is not supported in Unity?
What do you use instead?

I want to convert a hex number to an int in a javascript.

Stumbled across this in the wiki, which was lucky as I was looking for something else.

http://www.unifycommunity.com/wiki/index.php?title=HexConverter

ParseInt is supported:

var foo = "34";
var bar = parseInt(foo) + 12;

Or you can use Convert from .Net:

var bar = System.Convert.ToInt32(foo) + 12;

For hex you can use Parse:

import System.Globalization;

var foo = "a76e";
print (int.Parse(foo, NumberStyles.AllowHexSpecifier));

–Eric

Weird. When I tried it I kept getting errors thrown by the player. It compiled ok but when I ran it I got something about too many paint calls… I’ll have to try again.

I have three scripts for GUI. all use the parseInt().

When I build on the web version or Mac version I do not have any issues with the parse… but on the PC it will not consistently parse correctly.

I get waked out scientific notated value to the .0000000000 degree. This only happens on the PC runtime not the web or Mac runtime.

I am going to try System.Convert.ToInt32() to see if this is a work around.

I did get this to work fine in the end, I can’t remember what the issue was at the moment.