I have a controllable character that when you fall off map, a GUI will be created with a respawn button
void OnGUI() {
if(died==true){
GUI.Label(new Rect(daX, daY, 200, 40), "You died!!");
GUI.Label(new Rect(daX, daY-40, 200, 40), whyDie);
if (GUI.Button(new Rect(daX-75, daY+50, 150, 30), "Respawn!!!")){
transform.position = new Vector3(-5,20,5);
}
if (GUI.Button(new Rect(daX-75, daY+100, 150, 30), "Screw This!!!")){
Debug.Log("Back to menu");
}
}
}
The respawn and stuff works, is just that I don't know how to get rid of the GUI, so the respawn button stays there after you respawned. Does anyone know how to remove GUI objects? Thanks in advance
*EDIT: died, daX, daY, whyDie are variables I created and are valid