I am using unity3d 2018.2.6f1 version. I build my project to webgl platform.In my project I use a textfield in which I can pass a text with native mobile keyboard.when I try to run same project on mobile browser keyboard is not open at all.Kindly go through with this issue as I posted the same on forum.if you need any further info then please me know I am available to provide you.
Thank you for your sample project.
In Android: Itâs worked but have a problem:
In fullscreen mode: When I press in InputField, it show popup to input and I input somethings => press âOKâ or âCancelâ => PROBLEM: It exit fullscreen mode and I can not scroll up/down on my phone.
Hi @eforerog
I test iOS => it worked. But it just show popup to type text (not title). I want to create a title on popup to show user know that what user need to type. Can you help me?
This plugin works, but you should use different settings for IOS and Android on same input field game object. If you use âpromptâ, it works for IOS only, and âoverlayâ works for Android only. Look for documentation in page:
And this plugin works best at the moment. Yes, it is a bit ugly though, but it works.
After trying Kou-Yeungâs plugin on my last project with mixed results on different platforms in Unity 2021, I have written a lightweight custom solution. It is pretty straightforward and works across all browsers and devices, since it relies on Browser Pop-Up Boxes.
If you want to make your own plugin with that technique, essentially you will want to have a .jslib file with a function that calls the .js function window.prompt(description, currentText) and sends the result back to an object in unity once the user has confirmed or closed the prompt.
There is one additional thing you need to do: Overwrite the event systemâs OnApplicationFocus(bool focus) function, to prevent a bug that occurs only in Chrome for Android. (Took me a while to find that one )
I have polished and released my implementation, so if you want to save some development time on a feature that really should just be native in Unity, you can also check out my plugin. Pop Input by neoludic games
edit: I have a small update, Pop Input is now also on the Asset Store! Woop! It took almost 2 months for Unity to realize that a .jslib file is in fat not a legacy .js file, but hey, here is to a more seamless integration of my plugin into your projects!
I use a small script that helps to use the keyboard on the phone
using UnityEngine;
using TMPro;
public class WebGLInputList : MonoBehaviour
{
public TMP_InputField[] inputFields; // Array of TMP InputFields
private TouchScreenKeyboard[] keyboards; // Array of TouchScreenKeyboards
void Start()
{
// Initialize the keyboards array to the same length as inputFields
keyboards = new TouchScreenKeyboard[inputFields.Length];
}
void Update()
{
for (int i = 0; i < inputFields.Length; i++)
{
// Check if the current input field is focused and the keyboard is not already open
if (inputFields[i].isFocused && (keyboards[i] == null || !keyboards[i].active))
{
// Open the soft keyboard for this input field
keyboards[i] = TouchScreenKeyboard.Open(inputFields[i].text, TouchScreenKeyboardType.Default);
}
// Sync the input field with the keyboard input (in case keyboard is used)
if (keyboards[i] != null && keyboards[i].active)
{
inputFields[i].text = keyboards[i].text;
}
}
}
}