Check out example codes for "unity die script". It will help you in understanding the concepts better.

Code Example 1

using UnityEngine; using System.Collections;  public class Respawn : MonoBehaviour {     public GameObject Player;      void Start(){         Player = (GameObject)Resources.Load(Application.dataPath +  "/Resources/Player");         Debug.Log(Application.dataPath +  "/Resources/Player");     }      IEnumerator OnCollisionEnter(Collision collision)     {         if (collision.gameObject.tag == "Player")         {              Destroy(collision.gameObject);                          yield return new WaitForSeconds(2);              Instantiate(Resources.Load("Player"));         }     } }

Learn ReactJs, React Native from akashmittal.com