# Help with RectTransform

**URL:** https://discussions.unity.com/t/help-with-recttransform/663778
**Category:** UGUI
**Tags:** Scripting
**Created:** [May 5, 2017, 7:53pm UTC](https://discussions.unity.com/t/help-with-recttransform/663778 "2017-05-05T19:53:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![UppyMeister](https://avatars.discourse-cdn.com/v4/letter/u/5e9695/32.png) [@UppyMeister](https://discussions.unity.com/u/UppyMeister)
#### Post date: [May 5, 2017, 7:53pm UTC](https://discussions.unity.com/t/help-with-recttransform/663778/1 "2017-05-05T19:53:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![BlackPete](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/blackpete/32/553207_2.png) [@BlackPete](https://discussions.unity.com/u/BlackPete)
#### Post date: [May 5, 2017, 9:16pm UTC](https://discussions.unity.com/t/help-with-recttransform/663778/2 "2017-05-05T21:16:56Z")

</div>

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.
