Search Issue Tracker

Fixed in 4.6.X

Votes

1

Found in

4.6.0f1

Issue ID

646207

Regression

Yes

No way to set InputField's text by script

UI

-

To reproduce:
1. Open attached project
2. Open Test scene (The test scene has a single input field. Attached is a script that just sets the field's .text property to "Test Text" at Star)
3. Press play

4. Note that the inputField's placeholder text is cleared, but no text is put in its place. Check the inspector for the InputField. Its "Text" field will have text inside it, even though no text is being displayed in the game.

5. Toggle the "Also Set Text Component" checkbox on the script component attached to the InputField. Now the InputField's .textComponent.text will also be filled at Start

6.Enter play mode. The text will now appear in the InputField as expected. But... if you click on the InputField in game view to edit its value, then the text will be erased. The InputField thinks it's empty, even though it has a text value and its textComponent.text also has a value.

Comments (2)

  1. gmatthews

    Feb 24, 2016 12:14

    in 5.3.2f1, I get 2 different behaviours.
    1. If I have populated a script InputField variable through wiring it up in the Unity UI, then the script is able to set the InputField.text property, and I see this correctly reflected on the screen.

    HOWEVER

    2. If I create a prefab with an InputField and dynamically Instantiate the prefab then I CANNOT set the InputField.text property.

  2. RollingBell

    Aug 11, 2015 12:28

    It's not solved in Unity 5.1.2f.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.