Cant Get Width Height Of Content Size Fitter RectTransform

I have a GameObject with a UI text element and a content size fitter attached. It seems that once it is attached you can no longer retrieve the width/height of the recttransform of the object in script. Neither method I know works. They all return 0.


Does anybody know a way to still get these values?

The solution, it seems, it not to query the RectTransform, but instead the Text component.


Do you know by any chance how to acces the height of an object when it is not a text? I have a simple panel for my main menu (it’s height is also driven by a content size fitter) and i am struggeling to acces the height of it. This is driving me insane, why is it so hard to do such a simple thing?! please respond, when you have any tips for me!