New UI scroll area expansion

Hi!

I am making some level loader thingy and I need the scroll area to expand for each button. I tried doing this

customLevelsUI.levelList.sizeDelta = new Vector2(500, 300 - (j * 30));

to expand it per button. The line of code is located in a foreach loop. But it doesn’t work by doing it this way. I can’t really explain what happens. But do anyone know what I could do?

Thanks

You could simply add a content fitter to the parent.