- Home /
GUI.Drawtexure progressbar dissapears, when it should just look shorter.
Hello, I have this problem. I have 2 GUI.Drawtexture HUD progressbars. Both have white GUI.Drawtexure backgrounds. The problem is that once I shoot (deduct 1 bullet) the progress bar dissapears and I am left with just background, meanwhile, I have made a HP bar using the same system and the HP bar stays. Can anyone help me out with this? (I know I have foreground/background backwards but it's ok because the texures are correct. :D)
function OnGUI () {
GUI.DrawTexture(Rect(10,Screen.height - 60,300,20), AmmoFore);
GUI.DrawTexture(Rect(10,Screen.height - 60,300 * (InMag / Magsize),20), AmmoBack);
GUI.DrawTexture(CrossPos, CrossImage);
if(Reloading == false) {
GUI.Label(Rect(10,Screen.height - 60,300,20), InMag + "/" + Magsize, AmmoStyle);
}
if(Reloading == true) {
GUI.Label(Rect(10,Screen.height - 60,300,20), "Reloading.", AmmoStyle);
}
}
Answer by thecoolracer · Jun 10, 2013 at 07:03 AM
I fixed it! Turns out the variables InMag and Magsize were integers. Changed them to float and it works now!
Your answer
Follow this Question
Related Questions
How to create a HUD item like DeadSpace Stasis Meter? 2 Answers
Dynamically pass integer values into separate scripts in C#? 4 Answers
Customize a scripted GUI 1 Answer
Hud appear when trigger activate by camera 0 Answers
Make a RPM Display For my Car 0 Answers