Search Unity

Question [SOLVED] Going from HorizontalLayoutGroup parent to another parent?

Discussion in 'UGUI & TextMesh Pro' started by alex_roboto, Jan 28, 2023.

  1. alex_roboto

    alex_roboto

    Joined:
    Nov 11, 2019
    Posts:
    26
    I have a child UI object whose parent has a HorizontalLayoutGroup. I need to reparent the child to an arbitrary RectTransform that does NOT have HorizontalLayoutGroup.

    The reparenting works fine but the object Width and Height go crazy and the transform still indicates it's being controlled by HorizontalLayoutGroup (even though it's not a child of the HLG any more.)

    Here's the rect transform under the new parent:

    upload_2023-1-27_20-57-16.png

    Any suggestions for how to keep the width and height when moving from under HorizontalLayoutGroup to not being under a layout group?

    Thanks in advance.
     
  2. alex_roboto

    alex_roboto

    Joined:
    Nov 11, 2019
    Posts:
    26
    Solved. Silly mistake. The new parent had a LayoutGroup on it. When I attached to a parent that didn't have a LayoutGroup it worked fine.