For my inventory system, when you open the inventory there are 2 panels, one for your inventory and one for the chest/container you are looking into. So I have a horizontal layout group to split them up evenly over the screen like this:
I use a Scroll Rect to contain the slots of the inventory, and I get the width of the Scroll Rect’s “Content” object to correctly position the slots.
Without using the Horizontal Layout Group it works fine, but when I use it,
content.GetComponent<RectTransform>().rect.width
returns -120, even though I can clearly see (while selecting it in the editor during playtime) that it has a large positive width.
How can I get the width of the Content object’s rect since it’s being stretched?
