- Home /
Is there a way to limit GUI.TextField to numbers only?
After some research, I've found that I should be using something like RegEx, but I can't figure out how to implement it, because I have no idea how RegEx works.
I suppose I might be able to find something on RegEx if I had access to Google, but I don't at the moment (it's not that I'm lazy).
Thanks, Elliot Bonneville
Answered already here: http://answers.unity3d.com/questions/11553/restrict-characters-in-gui-textfield
Yes, I linked to that, but explained that I couldn't figure out how to implement RegEx for numbers only.
It's explained pretty well in the answer, but what you want is the regex @"[^0-9]" -- i.e. replace everything that's not a digit between 0 and 9. $$anonymous$$ore info on .NET regular expressions here -- http://msdn.microsoft.com/en-us/library/hs600312.aspx.
Okay, thank you. Put that in an answer and I'll accept it. (I just didn't know the correct term to use).
Your answer
Follow this Question
Related Questions
Allow only numbers in an input field 1 Answer
Automatic GUI generation systems? 1 Answer
GUI Over AI characters 1 Answer
3D Button? 1 Answer
Is there anyway to only show a part of a GUI image during the game? (C#) 1 Answer