- Home /
UI: Dynamically sized inventory window with scroll
I've been trying to get this done for a while now without success. Is it even possible with the UI? My current solution is calculating and setting the window size in code, but I'm hoping for a more elegant automatic solution.
Here's a schematic of the window I'm trying to make:
So we've got a fixed height title and close button, then we've got the inventory area which is a grid of items, all items have the same dimensions.
Now for the tricky part - The window should have a maximum height and width, and minimum height and width. Now, depending on the amount of items, it should stretch from it's minimum dimensions, first vertically until reaching the maximum height, then vertically until it reaches it's maximum width. If there are still more items, it should scroll horizontally.
I'm stuck with getting the window to resize according to the content. Any help would be great.
Have you looked at ContentSizeFitter and the various layout groups (vertical, horizontal, grid etc). I assume you are are using a ScrollRect panel for the window content?
Yes, I tried different combinations of those, but I haven't been able to find the correct combination to get the desired result. Not even sure if it's possible.
Your answer
Follow this Question
Related Questions
Place Inventory Into GUI Button Grid 3 Answers
GUI grid of buttons issue. 1 Answer
inventory system some help and guides please :) 1 Answer
Grid Layout Group leaking outside canvas. 1 Answer
scroll bar inventory with slot count for equip items 0 Answers