- Home /
TouchScreenKeyboard flickers
I'm having an issue when i build my scene to an iOS device , the native iOS keyboard flickers endlessly and game becomes non-interactive such that i can't even input any characters onto the textfield. I recently started experimenting with the TouchScreenKeyboard library and tried a bunch of relative solutions on unity answers but its still not resolvable. Here are 3 sections of my input class below. Any help would be great thanks.
void Start()
{
touchKeyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, true, true, false, false, "");
touchKeyboard.active = false;
TouchScreenKeyboard.hideInput = true;
//touchKeyboard = new TouchScreenKeyboard("", TouchScreenKeyboardType.Default, true, true, false, false, "");
}
//Inside OnGUI()
GUI.SetNextControlName("type here...");
playerName = GUI.TextField(new Rect(Screen.width / 2 - Screen.width / 20, Screen.height / 2 - Screen.height / 10, Screen.width / 2.2f, Screen.height / 10), playerName, 12, textStyle);
playerName = playerName.Replace("\n", "");
playerName = playerName.Replace(" ", "");
//platform dependent
#if UNITY_IPHONE || UNITY_ANDROID
MobileKeyboard();
#endif
void MobileKeyboard()
{
if (!isKeyboardOpen && !isDoneInput)
{
touchKeyboard.active = true;
playerName = touchKeyboard.text;
}
if (touchKeyboard.done)
{
touchKeyboard.active = false;
isKeyboardOpen = true;
isDoneInput = true;
touchKeyboard.text = touchKeyboard.text.Replace("\n", "");
playerName = touchKeyboard.text;
}
else if (touchKeyboard.wasCanceled)
{
touchKeyboard.active = false;
touchKeyboard.text = "";
}
}
Your answer
Follow this Question
Related Questions
keyborad not show up when user touch textfield on ios11 1 Answer
Input.GetKey () does not work on mobile Bluetooth keyboard 2 Answers
TextFields Android issue: switching between different fields it copies the string 0 Answers
How to set closeKeyboardOnOutsideTap? 0 Answers
TextField on Android clears the text when user tap outside the keyboard 1 Answer