On android (and iOS) when the user is done typing text into the input field they have a done button they can press. How can I wire into the done button pressed event ? I Input handles “return” on desktop just fine.
Tim-C
September 2, 2014, 6:43am
2
We will be doing a pass on this soon to fix the callbacks ect for input fields.
1 Like
jebi
September 2, 2014, 7:25am
3
I handle with this way;
Thank you man, you are awesome!
Here is my code; I used Text instead of InputField.
You must be call openKeyboard function on myText clicked.
import UnityEngine.UI;
public var myText : Text; // this your input field
private var Keyboard : TouchScreenKeyboard;
private var isKeyboardOpen : boolean;
private var KeyboardText : String = ""; // default text
function openKeyboard(){
Keyboard = TouchScreenKeyboard.Open(KeyboardString, TouchScreenKeyboardType.Default);
isKeyboardOpen = true;
}
function Update(){
if(isKeyboardOpen && Keyboard){
if (Keyboard.done){
//keyboard submitted
isKeyboardOpen = false;
myText.text = KeyboardText;
//do your staff
}
if(Keyboard)
KeyboardText = Keyboard.text;
}
}
http://forum.unity3d.com/threads/detect-submit-on-android.265602/#post-1755982