I have a GUI that pops up when I die that has a play again button. I have it so that if I have more than 0 lives, then it lets me play again. but if I have 0 lives and I press it, it should pop up a box saying “You are out of Lives” or something like that. But if I press it with 0 lives, it does nothing. Here is the snippet of code:
if(GUI.Button(new Rect(GameoverRect.x + GameoverRect.width - (Screen.width * .25f), GameoverRect.y + GameoverRect.height - (Screen.height * .25f), Screen.width * .25f, Screen.height * .2f), "", GUI.skin.GetStyle("PlayAgain")))
{
if(Lives > 0)
{
//AudioSource.PlayClipAtPoint(ButtonPressed, transform.position);
Application.LoadLevel(GameplayLevel);
}
else
{
GUI.Box(new Rect(Screen.width/2 - (Screen.width * .3f/2), Screen.height/2 - (Screen.height * .3f/2), Screen.width * .3f, Screen.height * .3f), "You need more Lives!", GUI.skin.GetStyle("OutOfLives"));
}
I have tried replacing “else” with “if(Lives <= 0)” but it still doesnt work…
I also checked and I do have the styles in my gui skin, and I am not getting any errors, but it still doesnt work.