- Home /
Anchored Positions of horizontal layout element children not set during Start Function.
I am trying to read the values of anchored positions for children of a horizontal layout element in the Start function of a script. But the anchored positions are not set when my code tries to read them. What is the right way to do this? How can I check if the layout has finished building and all the children are set and then read these values. Thanks for any help in advance.
Answer by Masterio · Jan 07, 2016 at 02:44 PM
You can use script execution order (if you are using many classes with many Start() methods inside).
You can write special initializer and initilaize it from one place. (Write Start() method in class and initialize all required data )
Thanks for the suggestions. The horizontal layout is not being populated or recreated on the fly, its elements are set before executing. Also, the script that tries to access the anchored positions of the childern of this layout is attached to the horizontal layout itself. So not sure how i can use script execution order or initializer to fix this.
Your answer
![](https://koobas.hobune.stream/wayback/20220612055232im_/https://answers.unity.com/themes/thub/images/avi.jpg)