Advertisement
GUPPYYYY

respawn or reset

Oct 31st, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6. public class KillPlayer : MonoBehaviour
  7. {
  8.     public GameObject player;
  9.     public Transform respawnPoint;
  10.  
  11.     void Start()
  12.     {
  13.        
  14.     }
  15.  
  16.  
  17.     void Update()
  18.     {
  19.        
  20.     }
  21.  
  22.     private void OnCollisionEnter(Collision other)
  23.     {
  24.         if(other.gameObject.CompareTag("Player"))
  25.         {
  26.            Scene currentScene = SceneManager.GetActiveScene();
  27.            SceneManager.LoadScene(currentScene.name);
  28.            //player.transform.position = respawnPoint.position;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement