Inconsistent UI order when instantiating prefabs

I’m instantiating UI elements as setting their parent an object in the scene that uses layout to order them as a list.

The problem is that the order they appear is inconsistent, and it seems like the order they appear in the UI has nothing to do with the order that I get in world.getChildren.

Is this a bug? Can I reorder the elements? What can I do?

I’m now almost 100% convinced this is a bug that has to do with timing.
The order is inconsistent when I create multiple elements in the same for loop, but if I add a delay to the loop, or do it step by step the order is maintained.

It would be really nice if someone could look at this problem in the engine, since it makes things more difficult when generating UI elements programmatically.

Assuming i is the index you can set the order with ecs.ThreeObject.set(world, eid, {order: i}).

I already tried this before, and it didn’t change anything, the order in the array is correct, but the order in the actual UI is incorrect.

Can you land your changes and share the project with the support workspace so I can take a look?