0

I am currently working to create an inventory system that contains multiple categories, each of which houses its own inventory slots. I have constructed a vertical layout group to do this, with the category headers as child gameobjects of the vertical layout group.

enter image description here

As you can see, this is working just fine. The number of categories is to change dynamically, with item slots able to be collapsed and uncollapsed with the little arrow at the side. I have the item slots showing up as intended.

enter image description here

The issue arises when I try to add a second category...

enter image description here

The vertical layout group does not recognize the item slots (which are currently housed as a child object of the category header) as part of the original object, and thus does not adjust other child objects around them. I have tried to use a content size filter, but this feature does not work for child objects of layout groups.

I have tried everything I can think of. While I could code this statically, so that everything moves a preset amount, I need everything in this system to be dynamic, including number of categories and the number of item slots per category.

Here is my hierarchy setup for this system (everything here is a child of the scroll view, if it helps.)

enter image description here

Thank you! I understand that this is a complicated issue, but I have tried every solution I can think of, and this time, Unity has bested me.

  • 1
    The issue is probably not even that complicated tbh: All you need to do is scale the `EquipmentSection` accordingly to fit all your child items (the name and slots) .. the VerticalLayoutGroup will then handle the rest .. buuut: again you will also need to scale the content accordingly to fit all your child elements so that the scroll is also correct ;) – derHugo Mar 08 '22 at 08:02
  • @derHugo Could you possibly give an example of this? I'm trying to scale the EquipmentSection, but the same problem seems to be happening. The scaled pieces are still overlapping. I'm sure this is a lot more simple than I'm making it, but I can't figure it out. – Finch Youngs Mar 08 '22 at 19:09

0 Answers0