I am trying to implement a progress bar system for my game. I know that it could be done with Unity's OnGUI and scaling with width of the texture but I don't want it to be a GUI element because in my game we would have several progress bars for each specific item.

In the below image you can see two of the progress bars and they are textures mapped on to a plane. enter image description here

The actual progress bar that needs to increase/ decrease in width is just a gameObject. I could just localScale and just scale it in the x direction of the gameobject but that scales in both directions. So scaling is not a solution. How do I make it work such that it I could control its width? Is there any other way I could implement this system? Or could I just use Unity's OnGUI for this purpose? Thing is this progress bars need to show up in the game on top of several gameOjects in the perspective camera view. So I am not sure if OnGUI would work for that. Any ideas?

I want something similar to what we see in games like LoL where they have health bars on top of the in game characters like in the image below

enter image description here


2 Answers 2


The easiest thing to do, I think, is asking your 3D artist to create a cube with the pivot point on the center of one of his faces instead of in the center of the cube. Than you'll be able to scale the cube along only one direction ( let's say his width) and obtain the effect you look.

Another option is to put a simple unity cube inside a parent empty game object, move the cube aside of the center of the parent, and then simply scale the parent object. Same final effect.

Hope it helps...


I would probably use a LineRenderer. You can manipulate the points.

The Line Renderer [...] renders billboard lines that have width and can be textured. [...]

Otherwise, you can take the route you're currently going, but in addition to scaling it along local X, translate it along the local X as well in order to offset the difference.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .