Search Unity

Horizontal/Vertical layout group functionality

Discussion in 'UGUI & TextMesh Pro' started by glad, Jan 30, 2020.

  1. glad

    glad

    Joined:
    May 10, 2014
    Posts:
    76
    Hi!

    I wonder how to make such thing:
    I have horizontal area(in my case it is horizontal scroll view content). I want each element to be expaned by height: i.e. when you resize the height of that area the element is adjusted its height respectively. And I want each new element to be adjusted to previous from the left / right side.

    For exmple. element aspect ratio is 1 (square). content size is 1000x100. So each element is 100x100, and each element is put next to previous so that coords would be (50,50), (150, 50), (250,50) and so on.
    If I resize the area to 1000x150 the elements sizes and coordinates should be changed. How can I do that using horizontal layout group.

    Thank you in advance.
     
    Last edited: Jan 30, 2020
  2. glad

    glad

    Joined:
    May 10, 2014
    Posts:
    76
    I figured out how to make that. Use ContentSizeFitter on content that is holding something and set constraints to prefered size. The content size would fit the contents elements.