- Home /
MissingMethodException: System.Int32.ToInt
Im trying to convert String to Int, so i can use the value in a TextField(requires String), and then converting so it will work out with: for (var y = -lysize.ToInt(); y < ysize.ToInt(); ++y)
here ysize and -lysize are Strings, which im trying to convert to Int, its succefull, because i can actually edit the value in a TextField
wich requires an Int, the log doesnt give me any compiler errors, but when i click the GUI.Button that executes that line, it gives me this error MissingMethodException: System.Int32.ToInt
Any help?
Have you tried printing the values of lysize
and ysize
using Debug.Log()
immediately before the for
loop?
Answer by Eric5h5 · Jun 01, 2013 at 06:37 PM
There is no "ToInt" function. You can use parseInt, or System.Convert.ToInt32, or Int32.TryParse. Put "#pragma strict" at the top of all your scripts so that you get errors at compile time, instead of when running them.
completely forgot about TryParse and ParseInt haha, ill try that now
Your answer
![](https://koobas.hobune.stream/wayback/20220613103337im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Accessing local system ( File Browser ) 2 Answers
How do I get the current overall System's volume? 0 Answers
Unity 2D Top Down Jump 1 Answer