// Use this for initialization void Start() { GameObject music = GameObject.Find("music"); musicScript callchange = (musicScript)music.GetComponent(typeof(musicScript)); if (musicNumber == 1) { callchange.playMultiplayer(); } else if (musicNumber == 2) { callchange.playSciFi(); } else if (musicNumber == 3) { callchange.playGangster(); } else if (musicNumber == 4) { callchange.playWestern(); } else if (musicNumber == 5) { callchange.playMain(); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; } if (PlayerPrefs.GetInt("MusicInput") == 0) { PlayerPrefs.SetInt("MusicInput", 1); } if ((PlayerPrefs.GetInt("MusicInput") == 1)) { DontDestroyOnLoad(this.gameObject); } else if ((PlayerPrefs.GetInt("MusicInput") == 2)) { Destroy(this.gameObject); } }
private void Awake() { if (singleton) { Destroy(gameObject); } else { singleton = this; DontDestroyOnLoad(this.gameObject); } }
void Start() { _musicScript = mySource.GetComponent <musicScript> (); _randomColor = new Color((float)Random.Range(0, colorPrecision) / (float)colorPrecision, (float)Random.Range(0, colorPrecision) / (float)colorPrecision, (float)Random.Range(0, colorPrecision) / (float)colorPrecision, 1.0f); _myParticles = this.GetComponent <ParticleSystem> (); }