Hello i'm a newbie to C# so i was wonder if any one could help me here I'm trying to make a simple health bar/ hit point bar which ever one you want to call it but it keeps coming up with "No Overload for method 'Box; takes '1' arguments"
Hers the solution:
using UnityEngine;
using System.Collecti ons;
public class playerHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;
// 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) + "/" + maxHealth);
}
}
Hers the solution:
using UnityEngine;
using System.Collecti ons;
public class playerHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;
// 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) + "/" + maxHealth);
}
}
Comment