- Home /
how to make a gui scrollbar render below another gui scrollbar
i was trying to make a healthbar so i made a red scrollbar and then a green one at the same location that goes down when the player loses health, the only problem is that the red one is on top
heres the script:
function OnGUI(){
GUI.color = Color.red;
GUI.HorizontalScrollbar(Rect (480,40,200,20), 0, 100,0, 100);
GUI.color = Color.red;
GUI.HorizontalScrollbar(Rect (20,40,200,20), 0, 100,0, 100);
}
Answer by syclamoth · Nov 03, 2011 at 06:09 AM
Why are you using scrollbars for this? It seems like a bit of a strange decision to me. Also, I don't see any green scrollbars there- it looks like they're both red to me.
Why don't you just use GUI.DrawTexture? Remember, things which are called later always draw on top of things drawn earlier, unless you are using GUI.depth to manually layer them.
Well, you can use GUI.depth, but I don't recommend using scrollbars for this. It seems very... hacky.
Your answer
![](https://koobas.hobune.stream/wayback/20220613031507im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Scrollbar Thumb Scaling 0 Answers
GUI.HorizontalScrollbar won't change it's height 1 Answer
Working health script? 2 Answers
How to change thickness of ScrollBar of GUILayout ScrollView? 0 Answers
manabar doesnt work 1 Answer