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();
}
}
}
@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.