void Awake() { //if this already exists, destory it if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(transform.gameObject); }
public void kill() { instance = null; Destroy(gameObject); }