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

How can I anchor a scrollrect's content?

Discussion in 'UGUI & TextMesh Pro' started by homer_3, Aug 26, 2021.

  1. homer_3

    homer_3

    Joined:
    Jun 19, 2011
    Posts:
    111
    I'm trying to make a scrollable view with a dynamic number of elements in it. So I have a panel with a scrollrect component and under that, a child panel which is set to be the scrollrect's content. Simply doing that forces the child to be positioned at the center of the scrollrect panel. How can I tell it to be positioned at the top?

    Since the child has dynamic content, I also had to add a content size fitter and a grid layout group to it. Despite the content size fitter showing the warning "Parent has a type of layout group component...." this all works fine.

    I'm guessing the solution would be to set the content size fitter to have a min size, but I don't see how I can configure that in my grid layout group.

    Adding an image to better show what I'm trying to do. What I have is on the left, what I want is on the right.
     
    Last edited: Aug 27, 2021