InputField not working on mobile?

I feel like I must be doing something really stupid. I can deploy the example UI project to my Windows Phone and the InputFields work fine (in the Widget scene).
But when I add my own (even in that same scene) they don’t. Tapping on them brings up the phones keyboard, but the actual text is not selected and it seems like the control doesn’t get focused. Typing does nothing.
The really weird thing is that 1 of every 10 or so taps actually works perfectly, but not the rest of the time.
I’ve tried constructing my input fields property-per-property exactly as the example ones, and they still don’t work.

I tried copying one of the two example InputFields to a different place on the scene and it seems like that has completely broken them all.

These all work 100% on PC.

1 Like

Nobody? This seems like a pretty big issue :frowning:

Raise a bug describing the steps + a repro project. They work fine for us on windows phone in our test cases.

Thanks, I’ve done this.

Repo steps are quite easy :stuck_out_tongue:
“create a new project, add a InputField, then run the project on the phone.”

Sure :slight_smile: It’s more for us to track the issue + bugs with projects get higher priority in our incoming bug quality rating system.

FWIW, if anyone else experiences this, Unity has confirmed it’s a bug.

I was starting to wonder if I was alone on this issue. Glad to see it’s already been acknowledged.

Any movements there? I have same problem with Unity 5.0 and I just updated to the 5.0f1 and still same problem with our Android build. Inputfield gets the focus but onscreen keyboard doesn’t show up. I have tried it with Nvidia shield tablet, Samsung galaxy tab 2 and with LG Nexus 5. Everything Works on pc. I also made one plain test scene only with three inputfields and eventmanager. It didn’t work.

Edit:
I think my problem is related to issue 660653: Unity Issue Tracker - U4.6 Metal Seed 1 - Can no longer use Input Field on iOS

The issue is already fixed in U4.6.2 and I hope it will soon come to next U5.0 release.

THIS BUG IS STILL NOT FIXED IN UNITY 4.6.4f!!! AHHHHH!!!

Please tell a workaround! I need it urgently for a pubilshed game!!! :hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed::hushed:

There’s not point doing a bug report because they just delete the bug report without fixing it!

My workaround was old gui input field wiht custom GUISkin.

  • “PasswordInput” variable is my uGui inputfield gameobject in the scene.
  • “password_default” is string variable with place holder text.
  • I used widthScaler and heightScaler floats because my orginal uGui is releative to screen size, so I can set dimensions of my input fields as percentages of screen size.
void OnGUI()
    {
        GUI.skin = skin;
        int width = Mathf.RoundToInt(Screen.width / widthScaler);
        int height = Mathf.RoundToInt(width / heightScaler);
        GUI.skin.textField.fontSize = Mathf.RoundToInt(height / fontscaler);
  
        if (passwordInput.gameObject.activeSelf)
        {
            Vector3 position = Camera.main.WorldToScreenPoint(passwordInput.transform.position);

            GUI.SetNextControlName("password_field");
            passugui = GUI.PasswordField(new Rect(Mathf.RoundToInt(position.x) - width / 2, Screen.height - Mathf.RoundToInt(position.y) - height / 2, width, height), passugui,'*');

            if (UnityEngine.Event.current.type == EventType.Repaint)
            {
                if (GUI.GetNameOfFocusedControl() == "password_field")
                {
                    if (passugui == password_default) passugui = "";
                }
                else
                {
                    if (passugui == "") passugui = password_default;
                }
            }
        }
}

Thanks. I may do something like this. Probably have an off-screen old GUI input and link that to the uGUI text field.

I’ve come up with a quick and dirty fix. It checks to see if the text has disappeared and if so uses the last stored value: (This is a fix for the problem of text in the textfield disappearing after you type it)

    string tempvalue="";

    public void ValueChange(string s){
        //Fix for Android: Prevent text disapearing after input
        if((s=="" || s==null) && tempvalue.Length>1) {
            s = tempvalue;
        }
        else tempvalue = s;
    }

    public void EndEdit(string s){
        //fix for Android: If text has disapeared use last available:
        if(s=="" && tempvalue!="") {
            s = tempvalue;
            inputfield.text = tempvalue;
        }
        //do something with value
        text2.text = s;
    }

It also prevents you from deleting all the text in a textfield in one go. But I think that’s a small price to pay.

Happy with that. :slight_smile: Me-1 Unity-0

Unless anyone’s got a better solution they could share?

Setting the vertical text alignment of the Text and Placeholder Objects to top and reassigning them to the InputField Object fixed this for me.