I am using a ContentSizeFitter on a Text object, but the sizeDelta property of the RectTransform is not being updated by the ContentSizeFitter so I can’t read the dynamic height. How can I determine the current dimensions of the RectTransform at runtime of a UI element being adjusted by ContentSizeFitter?
The sizeDelta property of the RectTransform is updated by the ContentSizeFitter. However, it only happens at the end of a frame (right before rendering) so if you’re querying it from script right after changing something that would affect it, the result won’t be correct yet.
You can invoke Canvas.ForceUpdateCanvases to have the new size calculated right away, though it has some overhead, so shouldn’t be invoked each frame.
1 Like
Awesome, that worked.