void Start() { persistentMusic = GameObject.FindObjectOfType <PersistentMusic>(); ballModelChooser = GameObject.FindObjectOfType <BallModelChooser>(); volumeSlider.value = PlayerPrefsManager.GetMasterVolume(); ballModelChooser.selectedModelIndex = PlayerPrefsManager.GetBallModelIndex(); }
void Awake() { if (!singleton) { singleton = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
public static PersistentMusic Instance; // Instance of Theme Music void Awake() { // Destroy if an Instance exists or assign this as Instance if not DontDestroyOnLoad(this); if (PersistentMusic.Instance == null) { Instance = this; } else { Destroy(gameObject); } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); return; } DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Start () { musicManager = GameObject.FindObjectOfType<PersistentMusic> (); volumeSlider.value = PlayerPrefsManager.GetMasterVolume (); difficultySlider.value = PlayerPrefsManager.GetDifficulty (); }