maxhacker11

RespawnController.cs

Nov 19th, 2023
1,144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | Source Code | 0 0
  1. using UnityEngine;
  2.  
  3. public class RespawnController : MonoBehaviour
  4. {
  5.     public static RespawnController Instance;
  6.  
  7.     public Transform respawnPoint;
  8.  
  9.     private void Awake()
  10.     {
  11.         Instance = this;
  12.     }
  13.  
  14.     private void OnTriggerEnter2D(Collider2D collision)
  15.     {
  16.         if (collision.CompareTag("Player"))
  17.         {
  18.             collision.transform.position = respawnPoint.position;
  19.         }
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment