Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How do I force my vertical layout group to only go downwards when new elements are added?

Discussion in 'UGUI & TextMesh Pro' started by tomowale, Aug 2, 2022.

  1. tomowale

    tomowale

    Joined:
    Feb 14, 2015
    Posts:
    308
    Might sound a bit confusing, basically, I have a scroll rect and an empty game object that has a vertical layout group (along with a content size fitter). Objects (text) go inside the empty game object and become children. When this happens, the prior text object is forced upwards in the layout group, but ideally, I don't want that to happen, I'd like the prior text object to remain where it is, and for the new one to be added right underneath the first.

    I've attached some images for reference, in the first image you can see the first text object (named first object) is added, in the second, another text object (named second object) is added and the layout group forces the first text object upwards, I don't want that, I want the first object to remain where it is, and for the added object to be added underneath without bothering the first. The third image shows my layout group stats.

    Any ideas?
     

    Attached Files:

  2. tomowale

    tomowale

    Joined:
    Feb 14, 2015
    Posts:
    308
    For similary confused devs, I ended up changing the pivot (the Y, increased it) on the object that holds my layout group, I then changed the "top" stat that you can find on the vertical layout group component itself