There is a RectTransform being controlled by a Grid Layout Group or some other Layout Group, because of this, the sizeDelta, anchorMin/Max, offsetMin/Max, rect, members all return 0, 0 but in the Inspector it does indeed show the width and height for the transform, but it is inaccessable.
I want to be able to get the w + h without knowing if the RectTransform is being controlled by a layout group.
i see this is old and i was searching for a better answer myself. The problem is that the Unity UI doesn’t know the size until all the elements are drawn (which with a grid makes no sense but whatever) so you can use a coroutine with a 1 frame delay to wait for the draw and then get the values from the rect.