Get the Rect property of a UI object inside a Canvas that has the HorizontalLayoutGroup Component
I have a Canvas that has a HorizontalLayoutGroup component. Inside this canvas there are three objects: a panel and two buttons. The arrangement is such that the buttons are on the sides and the panel is in the middle. During execution I need the RectTransform.rect.x and RectTransform.rect.y properties of the two buttons. I have tried in different ways, but in all I always get the same values (as if the objects were overlapped). I suspect that it is a problem with the HorizontalLayoutGroup component, in fact, removing it and arranging the objects "manually" does not meet this problem. However, the HorizontalLayoutGroup component is irreplaceable for arranging objects neatly on different screenaspects. Can someone help me get the right RectTrasnform values of the two buttons (which are the ones I actually see on the screen)?