I’m using the WebGL build on unity for my Convai-powered project, which I intend to make mobile-friendly. To facilitate interaction, I added a button that allows users to talk, and this functionality works fine. However, an issue arises when users prefer to type rather than talk. When they click on the TMP Input Field to type their message, the virtual keypad does not appear on mobile devices, making it impossible for users to type their input.
I’ve attempted to address this by manually triggering the virtual keyboard when the input field is selected, using TouchScreenKeyboard.Open
. I added an onSelect
listener for the TMP Input Field in the ‘ChatUI’ script, but it doesn’t seem to work in the WebGL build. Here’s the relevant code snippet:
_inputField = UIInstance.transform.Find(“Panel/InputField (TMP)”).GetComponent<TMP_InputField>();
if (_inputField != null)
{
inputField.onSelect.AddListener( => TriggerVirtualKeyboard());
}
private void TriggerVirtualKeyboard()
{
if (Application.isMobilePlatform)
{
TouchScreenKeyboard.Open(“”, TouchScreenKeyboardType.Default);
}
}
Despite the code implementation, the keypad either fails to show when the input field is selected or shows but is completely unattached, meaning when I type on it nothing comes up in the text input field. Does anyone have insights into why this might be happening in the WebGL build, or suggestions for alternative approaches to ensure mobile users can type their input?