Question by
squigglebucket · Oct 16, 2021 at 10:21 PM ·
uichildrenlayoutrecttransform
Proper way to wait until dynamically added children of a layout group are rendered
I have a few places in the project I'm working on where I need to access UI elements that are dynamically added as children of a parent with a Layout Group component. I then need to use the childrens' RectTransform components to calculate different things.
The problem with this is that the children don't update their RectTransforms until sometime after they've been added. I think it's a frame, because the Canvas has to render, but i'm a little shaky on that.
So I was wondering what the best way to wait for them to fully set their RectTransforms before I try to access them? Currently I'm using Invoke("MyFunctionThatUsesTheirRTs", .02f) but I'm sure there has to be a better way to handle this.
Comment