- Home /
How to get button pressed between 0 and any higher number of my choice?
I want to get the keyboard buttons where all numbers all in one line (1234567890). Like if one of them is pressed the script should debug.log the key of for example 4.
P.s. Sry for my bad English
Comment
Answer by sisse008 · Sep 16, 2019 at 12:10 PM
string numString = "1234";
int number;
if(int.TryParse(numString, out number))
{
Debug.Log ("String is the number: " + number);
}
taken from: https://answers.unity.com/questions/405149/checking-if-inputinputstring-is-a-number.html
Your answer

Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Make a Button Behave Like a Toggle 5 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
Button over a in offset texture 1 Answer