// Start is called before the first frame update void Awake() { if (Backgroundmusic == null) { Backgroundmusic = this; DontDestroyOnLoad(Backgroundmusic); } else { Destroy(gameObject); } }
void MakeSingletone() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
// Start is called before the first frame update void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else { Destroy(gameObject); } }