Hi, I have just created a new node with Layout component using Creator 3.8.5
Adding chilren in Editor and the children are auto arranged as expected
Using code to add chilren at runtime (or toggling children active/inactive) doesn’t cause the layout to be auto arranged.
Even calling Layout.updateLayout() doesn’t work
Could you the Engine developers please check out?
Thanks!
I tried to replicate the bug on a brand new project but it didn’t occur.
After a while debugging I have found the reason!
I added children to the Layout node when it’s active = false
I called director.pause() right before calling Layout.active = true. The pause command stopped the layout component from rearranging its children
I don’t know if it can be called an engine bug, but it could be pretty popular when the game devs try to show/hide some dialogs on game pause/resume. And some of the dialogs might contain cc.Layout
My case is special because it rendered the children “in the dark” when the dialog was not active.