This plugin uses native browser pop-ups to interact with Unity’s Input fields. This has a number of advantages, most critically of course mobile touch keyboard support in Web GL builds, a feature that should have long been native in Unity.To get started, simply add the component “Web GL Input Helper” onto a default Unity input field, or add the component Web GL TMP Input Helper” onto a TMP input field. Next, choose when the native pop-up should appear. If you want to add support for copy and paste or special characters, you might want to use our extension on every device type. Else, simply choose the option touch screens only in the Helper Type. Finally, add the description that should appear in your browser when a user clicks on this input field. That is it.
Well, sadly, as of writing (June 2022) there is a small quirk between Unity and Chrome for Android, where the focus is not returned to the game after a pop-up, you might want to address by replacing the default event system in your scene with the “Web Compatible Event System”. We hope that we can soon remove this little extra step, once the Chrome or Unity teams have fixed this small implementation bug.
How it Works
This plugin is designed to be a lightweight native implementation, to be as undisruptive but adaptable as possible. When a Web compatible input field is clicked, we call a JS function that creates a native browser pop-up prompt dialog. The current value in the text input field is parsed as a parameter, as well as the “salted” name of the sending input field.
This plugin has been tested in Firefox, Chrome and Safari on iOS 15.5 and on Firefox, Chrome and Opera on Android, and works perfectly fine. This plugin also works on all major desktop browsers. Please let us know should you encounter issues or incompatibilities.
Caveats and Bonuses
If your Web GL application runs in full-screen, the full-screen mode will be exited in some browsers by invoking a pop-up. Since full-screen is not supported on mobile Web GL this should in most cases not be an issue.Pop-up
This plugin relies on pop-ups. If used in a very text-input-heavy game, this might become annoying to players. Consider a different plugin if your game requires very frequent text input on mobile devices.Copy and Paste Support
By relying on native browser implementations, this plugin adds copy and paste support as well as autocorrection, emojis, utf8 symbols, and many native conveniences to your web text inputs.
If you encounter bugs, have feature requests or questions, feel free to reach out at [email protected]
© neoludic games 2022. All rights reserved.