Quantcast
Viewing latest article 13
Browse Latest Browse All 78

Answer by Kerihobo

fafase, you got it. So I suppose I should have guessed, but it wasn't entirely obvious to me at first, indeed it seems that LayoutGroup components override the properties of RectTransform in order to get that spacing, scale and position for the grid. This only makes sense. So what is the problem? Well, if you want to access your RectTransform while the parent has a LayoutGroup component, forget it. Solution? I found out that enabling the LayoutGroup ONCE, and then disabling it immediately after, allowed my children to retain their newly acquired transforms that they received from parent's LayoutGroup component. So... if you want nice organized grid, but you want to control the Rect Transforms too sometimes, maybe for animation at certain events... thennnnn... - Enable LayoutGroup component on parent. - Disable LayoutGroup componenent on parent. - job done, you have nicely aligned child GUI elements now, and you can access their posY property or any of their others. Note: I did however need to apply a LayoutElement component to each of the children to set limits for their min height/width. (To counter the devastating effects of parent's LayoutGroup component). For Interest's sake... "Why do you want to do this anyway???": For special FX, really magical ones that change based on properties of child GUI elements.

Viewing latest article 13
Browse Latest Browse All 78

Trending Articles