-
How to validate the characters of the strings to the characters typing via mobile keyboard?
over 9 years ago
-
over 9 years ago
Hey, Yes I have gone through the video.
I am saying something like this:-
string ToPrint = "Hello"; string temp = ""; InputField myTxt; string toCheck = ""; void Start() { toCheck = ToPrint.Substring (0, 1); } void Update () { temp = Input.inputString; if (temp == toCheck) ShowText (temp); } void ShowText(string val) { myTxt.text += val; if(myTxt.text.Length < ToPrint.Length) toCheck = ToPrint.Substring (myTxt.text.Length, 1); }
Hope this will work for you.
-
-
over 9 years ago
can you please describe more clearly have u seen the video @inder
-
-
over 9 years ago
Hey, You don't have to put the validation direct on your final InputField.
My suggestion is, that you use a temporary variable for the validation and if your validation comes successful(true) then you can put the correct string in the final InputField.
So with this if user will press wrong keys that will not display in your InputField.
-
3 Answer(s)