Ejemplo n.º 1
0
    void Awake()
    {
        //if this already exists, destory it
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(transform.gameObject);
    }
Ejemplo n.º 2
0
 public void kill()
 {
     instance = null;
     Destroy(gameObject);
 }