My goal is to create a system where the user can enter a number (preferably even with decimals) into a GUI text box. The idea is that the string is converted to a float, and this float is used for other purposes…
Here is the code I am trying:
var a = "";
var b = 0;
a = GUI.TextField(Rect(10,120,40,20),a);
b = parseInt(a);
First of all, if the code worked, it would only give me an int - so is there is any other way of converting the string so that it returns a float?
Second of all, using this method, I get the following error:
And please use the search as this comes up at least once a week or so. Searching the Scripting section only with the keyword “convert” turned up these two threads from last week, both of which discuss string-to-int and string-to-float techniques (and vice versa):