Search Unity

Question How to change the Anchor position under the VerticalLayoutGroup

Discussion in 'UGUI & TextMesh Pro' started by dkennedy69, Apr 9, 2023.

  1. dkennedy69

    dkennedy69

    Joined:
    Jan 22, 2017
    Posts:
    3
    Hi, I have a canvas with "World space" render mode. Then I have an image as the textfield underlay with the VerticalLayoutGroup attached to it.

    Finally, under this image I have another child - a text, that intended to stretch the image above depending on the string length (number of the rows).

    The problem is: when the row number in the string increases and the textfield stretches - it stretches upwards, covering my other UI elements. I need it to stretch downwards instead. To fix this I have to change the Anchor of the text element and set it to the bottom, right?

    But I can't make this as I have a prompt in the RectTransform of my text: "some values driven by VerticalLayoutGroup" and this value is exactly the anchor point of my text. So, I can't change the anchor position in the menu as the position always reset itself to the "Top Left".

    I tried to change the anchor point in the parental gameobject (the image) that have the VerticalLayoutGroup. I played around with the VerticalLayoutGroup settings, have read the https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-VerticalLayoutGroup.html Nothing helps.

    What am I doing wrong? How to make the text field stretch downwards? How to change the anchor point? Or maybe the anchor point is the wrong way and there is a better?

    Thank you.
     

    Attached Files: