GUI for health

I am trying to make a GUI to fit a health bar, and eventually other information. I want a red health bar to go over a black background, and the black background would have the health text on it… meh

using UnityEngine;
using System.Collections;

public class HealthBar : MonoBehaviour {
	public int maxHealth = 100;
	public int curhealth = 100;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	//GUI draw
	void OnGUI(){
		int width = Screen.width / 3;
		int healthwidth = width / (maxHealth/curhealth);
		GUILayout.
		GUI.Box(new Rect(10,10,width, 20), "Health: " + curhealth + "/" + maxHealth);
		
		GUI.color = Color.red;
		GUI.Box(new Rect(10,15,healthwidth, 10), " ");
		
	}
	
}

My issue is the fact that the bars are on the same layer? Therefore they are both black and useless? I would appreciate any assistance with this.

No, it’s just that Box skin is by default transparent, so you are seeing both boxes.

You should map a custom GUISkin using the GUI.skin = _yourSkin just before drawing the box.