Refresh Label Render Data before Reading Size
Immediately after changing Label text, its UITransform may still contain the previous dimensions. Waiting until the next frame works, but explicitly updating render data is clearer:
1 | const label = node.getComponent(Label); |