Hello, I have a small problem. I'm practicing on GUIs and I'm trying to have the user input a number for an array size. GUI.TextField requires a string and that is, from what I saw, the only real user input able text field for unity GUIs. I converted the string into an int and used an "for-in" conditional statement to do what i want with the array. In addition, I used an "if" conditional statement to see if the input is of numeric value. if (userInput != "") However, the user is still able to type in letters in the field and it gives me an error in the console. I'm having a total brain fart on the issue, but I'm trying to think of a way to make a conditional statement to test to see if the input is a valid int with no letters. Any thoughts? -S
Prevent any non-numeric characters from being used: Code (csharp): if (Event.current.character < "0"[0] || Event.current.character > "9"[0]) { Event.current.character = "\0"[0]; } userInput = GUI.TextField(... --Eric