Hi all
I am not sure this question is asked before or not. I have searched and couldn’t find. I want user to input in upper case in input field. I have tried:
public void OnValueChange()
{
inputField.text=inputField.text.toUpper();
}
This seems to work on desktop. HOwever, when I test it on android, application crashes. Does anybody have any idea?
This is just pure hypothetical since I am on my phone and can’t look up the code. Does setting the input fields text call OnValueChanged on Android? That would cause a Stack overflow and crash the ap.
I don’t have any idea, but maybe you should store the value to some temporary variable and compare the value first so it won’t loop infintely, something like
var upperText = inputField.text.toUpper();
if (upperText != inputField.text) inputField.text = upperText;
What your doing is fine, there was just a bug in the inputfield itself which i have fixed. You’d have to pull the whole UI source from https://bitbucket.org/Unity-Technologies/ui/overview to be able to get the fix right now or wait until at least the next patch release (p4). My guess though is that it will be p5 not p4.
The details explain how do it… (i’ve never done it) but i think its a matter of downloading, compiling (in your fav ide), copy the output to the specified folder, run unity.
you said problem will be solved in p5. I have installed unity4.6.2 but problem is still there:( But this time a bit different. Previously, aplication was crashing when I write from keyboard, now when I write something application restart again. Still, I cannot write in upper case in inputfield. What should I do?
I have discovered that when I write in upper case letters(from keyboard), it does not restart again. However when I write in lower case from keyboard, it restarts application. Interesting…
Is it possible that this showed back up in 5.6? I wasn’t having the problem in 5.2.3, but am updating my app and was crashing with the looping problem when trying to force all caps.