Search Unity

Scrolling Input Field Misaligns Caret

Discussion in 'UGUI & TextMesh Pro' started by toridominowski, Nov 20, 2017.

  1. toridominowski

    toridominowski

    Joined:
    Nov 7, 2016
    Posts:
    9
    I am trying to make a simple vertically-scrollable input field for my game, but I am having trouble with it. I currently have a Scroll View object with an Input Field as a child of the Content panel, and a Content Size Fitter and Vertical Layout Group on the Content Panel. However, whenever I enter a new line of text, the Content panel's size expands twice as much as it should, making the scroll field have just as much white space as text. Does anyone have any ideas on how to fix this? I have attached screenshots of my heirarchy and components.

    I have also tried omitting the Content panel entirely and just having the scroll rect react to the Text panel, but that causes a strange issue wherein scrolling in-game causes inputs to get misaligned, making Unity think a click took place further down the screen than it should have.

    Screenshots: https://imgur.com/a/rf6HO