Adjusting Rect Transforms Right Position

Hey guys!

I have need of a sliding bar that will start small and rapidly expand out towards the right (for example, and EXP bar as you gain exp). My initial thought was to have a gameobject with the image on it, and place the anchors to be left/right and then just change the objects right position so it would go out the way I want it to. However, I can’t seem to effect it at all. Setting the right to any number will not change it. I.E

obj.transform.right.Set(-500,0,0);

or

 obj.sizeDelta.Set(-500, 0);

If anyone knows whats going on, or a better way to go about doing it, that would be great! Thanks

Anybody? o:

Hey man, have you watched this live training? Recorded Video Sessions on UI - Unity Learn

You can use the same thing as he did for the HP and Ammo bar for your XP bar,

pretty easy and intuitive to use :slight_smile:

Glad to be of help.

1 Like