Search Unity

[to be closed] InputField inside a Horizontal Layout Group

Discussion in 'UGUI & TextMesh Pro' started by arnaud.gout.gex, Jul 11, 2015.

  1. arnaud.gout.gex

    arnaud.gout.gex

    Joined:
    Jun 4, 2015
    Posts:
    1
    Dear Unity users,

    I'm having trouble using the UI auto layout system along with the InputField element.

    Here is what I wanted: a UI text element with a button to activate/deactivate the edition of a field. (for example, a name)

    Here is what I did:
    Create a panel named 'NameEdit', add a horizontal layout group component, set Child Force Expand Width to false
    Create an InputField child of the panel 'NameEdit', add a layout element component, set flexible width to 1
    Create a button child of the panel 'NameEdit', add a layout element component, set flexible width to 0

    Try the UI in the player, the text inside the Input field is not showing.
    If I delete the button and the layout element component, and if i set Child Force Expand Width to true, it doesn't fix anything
    So, it appears that putting an InputField inside a horizontal group seems to break the text display of the InputField.
    Can anyone tell me what am I doing wrong here?

    Thanks in advance!

    EDIT: Ok my bad, I posted this issue since I struggled for hours, but it seems that the text disappeared because of the insufficient vertical size of the rect. And every single test I did, the vertical size of this rect wasn't enough, and I didn't notice. I should have waited some more before posting this!
     
    Last edited: Jul 11, 2015