Is there a way to avoid having the device auto-capitalize the first letter for Unity GUI textfields on mobile?
Answer by DaveA
Jun 08, 2011 at 07:38 PM
var lastStringLen = stringToEdit.Length;
stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
if (lastStringLen == 0 && stringToEdit.Length == 1)
stringToEdit = stringToEdit.ToLower();
that forces everything to lowercase, though... what about preventing the device from auto-capitalization, but allowing the user to capitalize if they choose
Edited answer. It will look to see if an empty input became a single character, if so, will lower it. Otherwise it leaves it alone.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
2 People are following this question.
Suppress Autocorrect in GUI.TextField
GUI: non-static text won't display on Mobile/Web player
Attach Text data to gameobjects by player
Speed of Gui Text vs 3D Text Mobile
Change the color of a label font that's using an EditorStyle.textField style?