I’m trying to set up a respawn menu that you can press to bring back your character to the spawn point with full health when this button is pressed. How do I hide the buttons after they are pressed?
Code:
ar respawnTransform : Transform;
private var playerIsDead = false;
var lookAround01 : MouseLook;
var lookAround02 : MouseLook;
var charController : CharacterController;
function OnGUI ()
{
if (playerIsDead == true)
{
if (GUI.Button(Rect(Screen.width*0.5-50, 200-20, 100, 40), "Respawn"))
{
RespawnPlayer();
playerIsDead = false;
}
if (GUI.Button(Rect(Screen.width*0.5-150, 240, 300, 340), "YOU ARE DEAD"))
{
Debug.Log("YOU ARE DEAD");
}
}
}
function RespawnPlayer ()
{
transform.position = respawnTransform.position;
transform.rotation = respawnTransform.rotation;
gameObject.SendMessage(“RespawnStats”);
lookAround01.enabled = true;
lookAround02.enabled = true;
charController.enabled = true;
Debug.Log(“Player has respawned”);
}