Quantcast
Channel: Questions in topic: "keyboard"
Viewing all articles
Browse latest Browse all 605

3d text to trigger mobile keyboard

$
0
0
I want to use 3d text as the button to trigger open mobile keyboard. Currently what I do is having a box as the collider as the child to the 3d text and change size accordingly to the length of the 3d text. Whenever you touch the box collider, it will trigger a GUI.Textfield and when you tap on the GUI.Textfield, the mobile keyboard will be launch for you to input. here's my code: void OnGUI () { if(inEditMode) { GUI.SetNextControlName ("hiddenTextField"); //Prepare a Control Name so we can focus the TextField GUI.FocusControl ("hiddenTextField"); //Focus the TextField guiString = GUI.TextField (new Rect (90, 100, 200, 25), guiString, 25); //Display a TextField textComponent.text = guiString; } if (Input.GetMouseButtonDown(0)) { ray = Camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray,out hit)) { if(hit.transform== boxcollider.transform) { print("touched!!"); inEditMode = true; } else { inEditMode = false; } } } } But I want to make do without tapping on the GUI.Textfield. Is it possible? I tried an alternative method: if (Input.GetMouseButtonDown(0)) { ray = Camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray,out hit)) { if(hit.transform== boxcollider.transform) { TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, true, true);///<-- Added this line!!! inEditMode = true; } else { inEditMode = false; } } } That `TouchScreenKeyboard.Open` did trigger a keyboard but do not sync with GUI.Textfield. but if you tap on GUI.Textfield at this moment, another keyboard will open and that will sync. At this point, you have 2 layers of keyboard. Any suggestions will be good.

Viewing all articles
Browse latest Browse all 605

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>