Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

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:
    24
    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:
    24
    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.