Search Unity

Vertical Layout spacing increase on object disable

Discussion in 'UGUI & TextMesh Pro' started by darkxether, Apr 18, 2018.

  1. darkxether

    darkxether

    Joined:
    Jan 11, 2012
    Posts:
    20
    Hey guys I got my vertical scroll working how I want it to. Except that when I disable an item after it is bought, the spacing between the remaining game objects grows instead of piling up near the top like a list. I was under the impression the child alignment setting under the vertical layout group was supposed to handle that. Any ideas on how to solve this?
    spaceCorrectly.PNG spacedIncorrectly.PNG ParentObject.PNG ScrollContent.PNG VerticalScrollItem.PNG
     
  2. Zonlib

    Zonlib

    Joined:
    Apr 15, 2014
    Posts:
    39
    Why do not you use "Grid Layout Group"?
     
  3. darkxether

    darkxether

    Joined:
    Jan 11, 2012
    Posts:
    20
    Sorry this is my first unity project!
    So a grid layout with a constraint on the number of columns? I didn't use the grid layout only because the vertical layout seemed like what I needed. And using the grid layout the items will group at the top when one is taken out?
     
  4. Zonlib

    Zonlib

    Joined:
    Apr 15, 2014
    Posts:
    39
    Grid Layout Group will work as your wish, but you have to enter the size of the item (Cell Size), and of course the items will be the same size.
     
  5. darkxether

    darkxether

    Joined:
    Jan 11, 2012
    Posts:
    20
    Thank you so much for your help!
     
  6. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Just for future reference, I'm fairly sure that was caused by the 'expand' option in the layout group.