Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

why the sceen doesn't reload

Discussion in 'Scripting' started by raidest45, Apr 13, 2020.

  1. raidest45

    raidest45

    Joined:
    Apr 12, 2020
    Posts:
    8
    Code (CSharp):
    1. public class OnPlayerDie : MonoBehaviour
    2. {
    3.  
    4.     void Start()
    5.     {
    6.        
    7.     }
    8.  
    9.  
    10.     void Update()
    11.     {
    12.        
    13.     }
    14.     void OnTriggerEnter2D(Collider2D other)
    15.     {
    16.          if (other.gameObject.tag == "playerKiller")
    17.         {
    18.             Destroy(gameObject);
    19.             GameObject go = new GameObject("nextLVL");
    20.             nextLVL script = go.AddComponent<nextLVL>();
    21.             script.LVLname = Application.loadedLevelName;
    22.         }
    23.        
    24.     }
    25.  
    26. }
    27.  
    why when i die the sceen didn't restar
     
  2. raidest45

    raidest45

    Joined:
    Apr 12, 2020
    Posts:
    8
    prob solved