jebi
August 30, 2014, 12:50pm
1
Hi guys. I’m trying to detect submit on inputfield. I found this code;
import UnityEngine.UI;
public var myInput : InputField;
function Start(){
myInput.onSubmit.AddListener(myInputSubmit);
}
function myInputSubmit(){
Debug.Log("test");
}
It’s work on desktop, but not works on Android. How can handle this?
crag
August 30, 2014, 11:34pm
2
Not sure what you are looking for but you could leverage:
if (GUI.changed) {
Debug.Log("Text field has changed.");
// do something
}
jebi
August 31, 2014, 6:00am
3
I’m looking for this buttons click event;
Or might be keyboard close event, if is exists Thank you for reply
jebi
August 31, 2014, 7:15am
5
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;
}
}
1 Like