Hi and happy new year evryone.
I try to make an input control in a TextField but i can not use the system.windows.form under Mono.
Is there a way to only write number and use delete and suppr key in a textField with C#.
thanks
Ok I find a nice way to do it
with thoses two lines
using System.Text.RegularExpressions;
private string onlyNumbers = "";
void OnGUI()
{
onlyNumbers= GUI.TextField(new Rect(30, 110, 30, 20), onlyNumbers, 3);
onlyNumbers= Regex.Replace(onlyNumbers, "[^0-9]", "");
}
thanx to Fishypants and Timmer
1 Like
Thanks Babator for sharing your solution.
Very helpful, thanks!!!
You are hero, man! Thanx!