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 !
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.
using System;
Convert.ToInt32(GUI.Textfield);