- Home /
to draw a health bar
Hi everybody! I'm now engaged in creating the health management of my game using playMaker (I use it for so many other things... awesome wonderful tool!). Let's make it simple. Say the health of Player depends on remaining energy. Energy lower as much as the time passes by. Say with playMaker I store two float values in two global variables (timeAtEnergyRecharged and runningTime). How can I draw a rect (filled of color) on top of a GUI element that I show on screen? What would you suggest to compute a health state and to show it in % on the GUI just using that rect? Thank you mates...
Answer by cody-burleson · Nov 09, 2012 at 05:16 AM
There's a three part series on MasterGamecraft.com that you might find useful for this:
How to Create a Player Health Status Indicator for the Unity GUI, Part 1
How to Create a Player Health Status Indicator for the Unity GUI, Part 2
How to Create a Player Health Status Indicator for the Unity GUI, Part 3
Answer by gregzo · Apr 09, 2012 at 11:10 AM
You could adjust pixelInset.width of another GUIElement placed on top of the first.
Your answer
![](https://koobas.hobune.stream/wayback/20220613070106im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I want to add a health bar to existing code 1 Answer
Another GUI question. HealthBar 1 Answer
GUI health bar issue 2 Answers