Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Layout with Flexible Height/Widths (nGUI TableView)

Discussion in 'UGUI & TextMesh Pro' started by NVenti2, Nov 18, 2014.

  1. NVenti2

    NVenti2

    Joined:
    Nov 18, 2014
    Posts:
    2
    How would one go about constructing a vertical layout with elements that have flexible heights ? In nGUI there was the 'Table' for handling these situations. How would I solve this problem in uGUI ?

    Here is an example.



    As you can see, I have a scroll area with a vertical listing of elements. The elements have a multiline text which cause the element to have a variable height. The element root has been set to have a flexible height (and a minimum height of 90). However, when I add new elements the 'real' size is ignored.

    Moreover I am unable to figure out how I can set the texts to have a background image when It is sized dynamically... though technically that is another issue.
     
    rakkarage likes this.
  2. Feaver1968

    Feaver1968

    Joined:
    Nov 16, 2014
    Posts:
    70
    I believe you can use a Vertical Layout Group and Content Size Fitter (with Vertical Fit, preferred size ?) on the parent RectTransform that holds the ScrollRect content.
     
  3. NVenti2

    NVenti2

    Joined:
    Nov 18, 2014
    Posts:
    2
    Thanks but placing a Content Size Fitter on a layout element throws up a warning because it is child of another Vertical Layout fitter (on the container). Moreover... the solution does not change anything.