// Sets up singleton instance. Will remain if one does not already exist in scene void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else if (instance != this) { Destroy(gameObject); } }