Search Unity

input field not working in webgl build in mobile browser.

Discussion in 'Web' started by A_never_kill, Oct 10, 2018.

  1. A_never_kill

    A_never_kill

    Joined:
    Jan 7, 2014
    Posts:
    81
    Hi,
    Hope you are doing well!

    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.

    Many thanks
    Aman
     
  2. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,073
    As the manual states the current WebGL build target doesn't support mobile devices and hence mobile text input. Sorry.

    We have something in the works especially for mobile browsers and instant games https://unity.com/solutions/instant-games but it is not released yet.
     
  3. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,073
  4. A_never_kill

    A_never_kill

    Joined:
    Jan 7, 2014
    Posts:
    81
  5. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,073
    I don't know of any, sorry.
     
  6. eforerog

    eforerog

    Joined:
    Oct 25, 2014
    Posts:
    1
  7. CesarNascimento

    CesarNascimento

    Joined:
    Mar 26, 2013
    Posts:
    15

    Attached Files:

  8. nbkhanhdhgd

    nbkhanhdhgd

    Joined:
    Apr 19, 2016
    Posts:
    23
    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.
     
  9. nbkhanhdhgd

    nbkhanhdhgd

    Joined:
    Apr 19, 2016
    Posts:
    23
    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?
     
  10. vanshika1012

    vanshika1012

    Joined:
    Sep 18, 2014
    Posts:
    48
    StarArcher likes this.
  11. dangnguyen113

    dangnguyen113

    Joined:
    Aug 8, 2017
    Posts:
    7
    ios ok, but android sometime error.
     
  12. OleksandrMartysh

    OleksandrMartysh

    Joined:
    Dec 13, 2015
    Posts:
    25
    I did my research and tried every plugin I could find. I used Unity 2020.3.28f1 and tested both on Android-phone and iPhone.Here is my report.

    These plugins don't work:
    https://unitylist.com/p/f58/Unity-webgl-inputfield
    https://github.com/eforerog/keyboardMobileWebGLUnity
    https://github.com/dantasulisses/WebMobileInputFix

    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:
    https://github.com/unity3d-jp/WebGLNativeInputField

    And this plugin works best at the moment. Yes, it is a bit ugly though, but it works.
    https://github.com/kou-yeung/WebGLInput
    And there is a fix for Unity 2021 for it:
    https://github.com/kou-yeung/WebGLInput/releases/tag/1.0
     
    uz986, Ismaeel370 and Meta_Tron like this.
  13. DavidLeertasteW

    DavidLeertasteW

    Joined:
    Dec 17, 2017
    Posts:
    5
    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 :D )
    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. https://neoludic-games.itch.io/pop-input

    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!

    https://assetstore.unity.com/packages/tools/input-management/pop-input-225293
     
    Last edited: Jul 27, 2022
  14. ilezhnin

    ilezhnin

    Joined:
    Jul 17, 2013
    Posts:
    17
    Just use legacy input field it don't have such issue.
     
  15. natirupe

    natirupe

    Joined:
    Aug 23, 2023
    Posts:
    1
    this didnt worked for me, i followed your advice, and i have the same problem still