UnityEngine.Rect’ does not contain a definition for curHealth' and no extension method
curHealth’ of type `UnityEngine.Rect’ could be found
Also appears and i need help on this.
using UnityEngine;
using System.Collections;
public class HealthBar : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;
public float healthBarLength;
// Use this for initialization
void Start () {
healthBarLength = Screen.width / 2;
}
// Update is called once per frame
void Update () {
AdjustCurrentHealth(0);
}
void OnGUI() {
GUI.Box(new Rect (10, 10, healthBarLength, 20 ). curHealth + "/" + maxHealth);
}
public void AdjustCurrentHealth(int adj) {
curHealth += adj;
healthBarLength = (Screen.width / 2 ) * (curHealth / (float)maxHealth);
}
}