Search Unity

Removing panels from layout grips while resizing outer rectangle instead of just increasing spacing

Discussion in 'Editor & General Support' started by kbrenner, Jun 21, 2021.

  1. kbrenner

    kbrenner

    Joined:
    Nov 16, 2020
    Posts:
    5
    Hi,

    I'd like to create a vertical layout group that allows me to script specific panels to be removed based on button clicks. I know that with layout groups, this can be done; however, if for example, we have 3 panels laid out vertically, and we decide to remove panel 2 (the middle one), the layout group will just resize the spacing between panels 1 and 3 so that they are evenly distributed throughout the layout group. Is it possible instead to just resize the outer rectangle of the layout group so that the distance between panels 1 and 3 is the same as the distance was between 1 and 2/2 and 3 before? That way, there isn't a large distance between panels if multiple other panels are deleted on certain button clicks.

    Thanks
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    This is controlled by the properties of the layout group, specifically those related to child control.