- Home /
Question by
VincentRodriguez · Oct 13, 2012 at 04:24 PM ·
guiinttextfield
GUI.Textfield to int ?
Hello world,
I'm creating an app with unity, and I want to set coordinates (x,y) with textfield, but when I looked in documentation there was written that textfield returns a string... But I need int... Can you help?
Thanks in advance !
P.S. Javascript if possible !
Comment
Best Answer
Answer by Eric5h5 · Oct 13, 2012 at 05:03 PM
It's best if you prevent users from entering anything except numbers in the textfield (see here), then you can use ParseInt or whatever. Otherwise you need to use TryParse, and other methods wouldn't be sufficient, since you'd have to account for users entering non-numeric data.