dynamically re-arranging gameobjects in grid layout group

Hi everyone,

I have a panel(dropAreaHolder) which has a scrollable panel(dropArea) as a child. In my game I instantiate game objects by drag and drops and put them inside my scrollable panel (dropArea) (just like the idea in Scratch, cloning code blocks and putting them in a coding area). My coding area can only show about 20 code blocks. When the number of code blocks is larger than 20, then my scrollbar will become visible and player can scroll and see everything. When the number of code blocks become 20 or less, scrollbar is hidden again and scroll rect component is disabled. Up to this point everything works just perfect. But the problem is that when i remove lets say the first code block, the code blocks do not re-arrange themselves so i can’t see all 20 code blocks, the last one always remains at the bottom - out of the masked area.

It looks something like that:

I have a problem somewhat like this and would like to know if you found a way to update the GridLayoutGroup.

My problem is when I SetActive(true) an object in the GridLayoutGroup(glg), glg does not update the positions, so the object does not align with the others like it is meant to…

I found a hotfix, which is the:


It somehow sets off a process which works for me.