Hello, I’m currently following a tutorial on how to make a game; however, I’m stuck on the section about making my player’s health bar. Everything seems fine, for example I can drag the script to my player and not get any errors, however it won’t show up on the actual game.
Here’s my script:
using UnityEngine;
using System.Collections;
public class PlayerHealth : MonoBehaviour {
public int maxHealth = 54;
public int curHealth = 54;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void onGUI() {
GUI.Box(new Rect(10,10,Screen.width / 2 / (maxHealth / curHealth),20),curHealth + "/" + maxHealth);
}
}
Would any of you be so kind as to show me where I went wrong?
I would also like to point out that I’m new to Unity and scripting itself so please be easy on me.