Help with RectTransform

Hi,

On my loading bar script:

“loadingBar.rect.width” returns the correct width

but in my xp script:

“xpBar.rect.width” always returns 0

The gameobject is active at the time of fetching the width.

Any Ideas? Thanks

It might depend on how your pivots and/or anchors are set up. I get confused by that pretty often as well.

Try checking rectTransform.sizeDelta for the actual width.