I am getting this error when I try to say that my health is at 0 to load the level of my main menu
public static int Health;
void update ()
{
//continuously damage player
DamagePlayer(1);
if(Health <=0);
Health =0;
destroy (gameObject);
Application.LoadLevel("scene1");
}
Please format your code with appropriate spacing and line breaks following some sort of standard, e.g.:
public static int Health;
void update () {
//continuously damage player
DamagePlayer(1);
if(Health <= 0){
Health = 0;
Destroy (gameObject);
Application.LoadLevel("scene1");
}
}
After doing that, if the error persists, please indicate exactly which line the error is occurring on.
Another question, unrelated to the issue, do you know why are you declaring Health as a static? This would ordinarily be used to ensure that Health is the same value for all instances of your class.