// Use this for initialization void Start() { if (instance == null) { instance = this; } DontDestroyOnLoad(gameObject); }
// Use this for initialization void Start() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(Instance.gameObject); Instance = this; } DontDestroyOnLoad(gameObject); }