UITK Layout Engine Update Cycle

The docs state: " When the element is added to the hierarchy, resolvedStyle.height can be NaN until the layout updates." (source). The docs also state: " You can also poll the value during the MonoBehaviour.LateUpdate phase at runtime if you have access to MonoBehaviours." (source)

Sadly, I can’t find more information about the frequency / timing of the layout updates anywhere and I have read contradicting comments with people saying that the layout update can take multiple frames to finish and others saying it is always up to date on the next frame. In my testing, so far it always was up to date on the next frame.

So my question is: When does the layout update happen exactly and how often does it happen? E.g. is it guaranteed to be finished on the next frame, even on weak hardware?

It also would be nice, if a section about this topic is added to the docs.

Cheers

Right here in the player loop: UnityCsReference/Runtime/Export/PlayerLoop/PlayerLoop.bindings.cs at master · Unity-Technologies/UnityCsReference · GitHub

So between the Update and LateUpdate Unity messages.

From my understanding, some visual elements, like PropertyField will build themselves over multiple frames. But that’s just particular to how those elements, and now how layouts are calculated in general.

1 Like

Thank you so much for your precise and insightful answer. I appreachiate it a lot!

1 Like