private void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } }
// Use this for initialization void Awake() { if (staticBackground != null) { Destroy(gameObject); } else { staticBackground = this; DontDestroyOnLoad(gameObject); } audio = GetComponent <AudioSource>(); audio.PlayOneShot(titleScreen, 0.2f); }