So, after some preliminary analysis of the InputField code, trying to specifically chase down giano574’s “Problem #2,” it looks like on my Kindle Fire, when the “Done” button is tapped, m_Keyboard (a TouchScreenKeyboard) briefly hiccups, and thinks its text value is empty. (Why, I have no idea.) That causes m_Text to get set to “”. Shortly after that, m_Keyboard reports that it’s no longer active, and this causes OnDeselect to be called. Ironically, by the time that happens, m_Keyboard knows what its text value is again! (Weird!)
I THINK I have a VERY TEMPORARY hack – er, I mean workaround for Problem #2 that you can use until the fine Unity folks fix this problem the right way.
First, grab InputField.cs from the link I provided above. You’ll probably also need SetPropertyUtility. (Alternatively, you can grab the entire UI source, if you’re feeling adventurous). I renamed my InputField, just to keep things clear. Now, go to the LateUpdate function, and somewhere around line 533, you’ll find this code:
if (m_Keyboard == null || !m_Keyboard.active)
{
if (m_Keyboard != null && m_Keyboard.wasCanceled)
m_WasCanceled = true;
OnDeselect(null);
return;
}
Change that to read:
if (m_Keyboard == null || !m_Keyboard.active)
{
if (m_Keyboard != null && m_Keyboard.wasCanceled)
{
m_WasCanceled = true;
}
// Silly hack to stop losing text when mobile keyboard is done.
// See http://fogbugz.unity3d.com/default.asp?689380_uacuc6evpsvqj7at
m_Text = m_Keyboard.text;
SendOnValueChangedAndUpdateLabel();
OnDeselect(null);
return;
}
In this instance, the keyboard code is not going through the validation system, but in theory, the text that is in there when this is happening should have already been validated.
I haven’t analyzed Problem #1 in any great depth yet, but there definitely seems to be some weirdness in the keyboard system.