I have a health bar system and i need the health to be above the bar that it is in so that it appears as if the bar is slowly draining but for some reason it is behind I don't get this?
How do I make the health take preference over the bar in the GUI?
Mike_3
2
You can use the z position to set the rendering depth. The lower it is, the more in front it should be
yoyo
3
If your GUI textures are drawn from different components, you can also set GUI.depth in the various OnGUI() methods ... to make Component1 draw over top of Component2:
Component1:
void OnGUI()
{
GUI.depth = 1;
...
}
Component2:
void OnGUI()
{
GUI.depth = 2;
...
}