How can I make a death screen for my player?

Hello, I’m very new to unity and I have made this death function for my player, but I don’t know how to make a death screen so that you have to press a respawn button to get back in.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Respawn : MonoBehaviour
{
    [SerializeField] private Transform player;
    [SerializeField] private Transform respawnPoint;


    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            player.transform.position = respawnPoint.transform.position;
            Physics2D.SyncTransforms();
        }
    }
}

There are a few ways to do it, but the simplest that will get the result you are looking for is using UI panels or images.

Here is a brief video that can help you out:

2 Likes

@Cornysam 's response is right on point for this particular problem.

If you want another awesome perspective that also includes a FIREHOSE of amazingly useful stuff, check out this tutorial, but be prepared to work at it for a while.

There’s also an incredibly useful timestamp list in the description (expand), and at 38:50 he gets into the Game Manager that handles states like this.

1 Like

@Kurt-Dekker great share, im going to check it out myself!

1 Like

this is a very good tutorial thanks for helping

1 Like

Please use the Like button rather than necroing posts.

Thanks.