Avoid auto device capitalization for textfields on mobile

Is there a way to avoid having the device auto-capitalize the first letter for Unity GUI textfields on mobile?

more ▼

asked Jun 08 '11 at 07:40 AM

ina gravatar image

4.2k 591 642 684

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
var lastStringLen = stringToEdit.Length;
stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
if (lastStringLen == 0 && stringToEdit.Length == 1)
  stringToEdit = stringToEdit.ToLower();
more ▼

answered Jun 08 '11 at 07:38 PM

DaveA gravatar image

32.4k 158 176 278

that forces everything to lowercase, though... what about preventing the device from auto-capitalization, but allowing the user to capitalize if they choose

Jun 08 '11 at 07:41 PM ina

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.

Jun 08 '11 at 07:56 PM DaveA
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Jun 08 '11 at 07:40 AM

Seen: 1489 times

Last Updated: Jun 08 '11 at 07:56 PM