// Start is called before the first frame update void Start() { audio = GetComponent <AudioSource>(); if (PlayerPrefs.GetInt("MusicOn") == 1) { audio.Play(); } else { if (audio.isPlaying) { audio.Stop(); } } // Singelton if (mController != null) { Destroy(gameObject); } else { mController = this; DontDestroyOnLoad(gameObject); } }
private void Awake() { if (gameStatus == null) { gameStatus = this; } else if (gameStatus != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }