Have recently started using the new gui system, but have become a stuck with increasing the vertical size of a panel with a gridlayout, as new objects are added to it. This is for an inventory system. Objects already in the current inventory are added to the panel with code & prefabs, and objects from other inventories can be dragged and dropped.
The prefabs are set to 250 x 125, and the grid to the same. I’ve include a scene and game screen grab. If anyone can give me a nudge in the right direction, I’d be very grateful.
Not totally clear what you want but I’d guess you need a parent panel for your inventory panel with a ScrollRect Component on it and a Mask.
Add a Content Size Filter to the inventory panel and set the prefabs to have a Layout Element with a minimum height/width set.
The panel should expand to fit items and the scroll rect will allow it to scroll.
You probably want to restrict movement to just vertical but that’s up to you.
EDIT
Sorry, working on a very small screen so not always easy to see. I don’t currently have access to Unity, hence the phone being used but…
I bet if you put a layout element on the panel itself you could set its min size with that.
You should be able to do this via code if the aspect ration/resolution is likely to change. Just find/add the Layout Element when the menu opens and set the minimum to be the size of the parents x/y.