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 user 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.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
2 People are following this question.
Change the color of a label font that's using an EditorStyle.textField style?
Suppress Autocorrect in GUI.TextField
GUI: non-static text won't display on Mobile/Web player
Disable left/right cursor movement in TextField when pressing up/down arrow keys
Attach Text data to gameobjects by player