- Home /
How do I scale a GUITexture from the sides instead of in the center?
I want to make a progress bar (think of healthbar but instead of decreasing length from 100%, I want to to increase the length to 100%) but Im having this problem where the GUITexture scales from the center. I dont want to use PixelInset.width as that is not what I'm looking for (it will mess my scaling eg. If I go from a 1920 X 1080 screen to a 800 X 600 screen mid way through the game, it would not resize properly.)
I hope this makes sense. I'll try to explain more if you have problems understanding it. Appreciate any help given. Thanks
Answer by Artaani · Sep 27, 2013 at 09:23 AM
Just modify your Rect. For example:
new Rect (0, 0, CurrentHP, 40)
Where CurrentHP is your float var.
Isn't that method for OnGUI() ?
GUITextures is a part of GUILayer, Not OnGUI.
Your answer
Follow this Question
Related Questions
Make my HUD full screen 2 Answers
How to do .9 scale for scaling screen? 0 Answers
Scale GUITexture to screen resolutions 1 Answer
OnGUI vs GUITexture for Tablets and Phones 2 Answers
How expensive is scaling in 2D unity? Is it better to pre-scale? 1 Answer