Error message:
Assets/Scripts/PlayerHealth.cs(42,62): error CS1525: Unexpected symbol `)’
I’m trying to give my player some health, but I can’t test it…
I’m using C#.
using UnityEngine;
using System.Collections;
public class PlayerHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;
public bool dead = false;
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 (0, 0, healthBarLength, 20), "");
if(dead == true)
Dead();
}
void AdjustCurrentHealth(int h) {
if(curHealth < 0) {
curHealth = 0;
dead = true;
}
if(curHealth > maxHealth)
curHealth = maxHealth;
healthBarLength = (Screen.width / 2) * (curHealth / (float)maxHealth);
}
void dead () {
if(GUI.Button(new Rect(0, 0, 100, 50), *Dead*)) {
}
}
}