void OnInput (string input)
{
if (selected && enabled && gameObject.active)
{
// Mobile devices handle input in Update()
if (Application.platform == RuntimePlatform.Android) return;
if (Application.platform == RuntimePlatform.IPhonePlayer) return;
foreach (char c in input)
{
if (c == '\b')
{
// Backspace
if (mText.Length > 0) mText = mText.Substring(0, mText.Length - 1);
//NEW MESSAGE
gameObject.SendMessage("OnInputChanged", mText, SendMessageOptions.DontRequireReceiver);
}
else if (c == '\r' || c == '\n')
{
// Enter
gameObject.SendMessage("OnSubmit", SendMessageOptions.DontRequireReceiver);
selected = false;
return;
}
else
{
// All other characters get appended to the text
mText += c;
//NEW MESSAGE
gameObject.SendMessage("OnInputChanged", mText, SendMessageOptions.DontRequireReceiver);
}
}
// Ensure that we don't exceed the maximum length
UpdateLabel();
}
}