How would I make it so once the player dies a button appears?
I already have the restart level coded, and I have the button on screen that utilizes that code. How do I m
public GameObject YourButton;
keep the button inactive while the player is alive. Once he is dead, execute the following code.
YourButton.gameObject.setActive(true);
This would activate the button on the screen.
Add this code in void Update() and change the code in void start() and collision to:
// // Update is called once per frame
void Update () {
if(isDead == true){
RESTART_BUTTON.gameObject.SetActive(true);
}
}
void Start () {
if(isDead == false){
RESTART_BUTTON.gameObject.SetActive(false);
}
}
public void OnCollisionEnter2D(Collision2D collision){
Debug.Log(collision.gameObject.tag);
if(collision.gameObject.tag == "Death"){
isDead = true;
}
}
That should do the needful.