Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to make a respaen script in unity

//Unity//
//You Can Change "void Update" to "OnTriggerEnter (Collider other)" and compare tag to something like "RespawnTrigger"  

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

public class Respawn : MonoBehaviour
{
    void Update()
    {
       if (Input.GetKeyDown(KeyCode.R))
       {
           SceneManager.LoadScene("123");
           Debug.Log("Respawned");
       }
    }
}
 
PREVIOUS NEXT
Tagged: #respaen #script #unity
ADD COMMENT
Topic
Name
5+1 =