Positions of UI Elements under Vertical Layout Group

Ok,
I have a canvas in world space. And i have a ui element with Vertical layout group on it.
now there are 5 Buttons under the vertical layout.

Now if i access their position using RectTransform.position, all buttons have same position values which is lower left corner of the vertical layout group! Is this a bug or am i doing something wrong?

Please help, Thank you!

Well i guess this is a bug,I was reading the position in the Start() method and when i checked it in Update() method, the position returned is correct!

The elements haven’t been laid out until the layout manager runs. This is at the end of a frame.

Oh, i did not know about that. Thank you!

do from the error, it was designed(((
in some version of Unity is working correctly!!! a bug that decided to leave as it is, and to assert that it should be
it is not the only case

Is there a way to find out if it has been laid out yet? I’m having the same problem and I don’t really like the idea of just waiting one frame.

2 Likes

This will be called twice, but worked for me.

private void OnCanvasGroupChanged()
{
// check transform values
}