// Start is called before the first frame update void Start() { button = GetComponent <Button>(); mainMusic = FindObjectOfType <MainMusic>(); image = GetComponent <Image>(); musicPlaying = mainMusic.isPlaying(mainMusic.nowPlaying); //Debug.Log(musicPlaying); image.sprite = musicPlaying ? pause : resume; }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); //musicSource = GetComponent<AudioSource>(); }
void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private void Awake() { if (_instance && _instance != this) { Debug.LogWarning("Music was already found on the scene, I will self-destruct, bye!", this); Destroy(gameObject); return; } _instance = this; DontDestroyOnLoad(this.gameObject); }
private void Awake() { DontDestroyOnLoad(gameObject); if (instance == null) { instance = this; } else { Destroy(gameObject); } _audioSource = GetComponent <AudioSource>(); }
void Awake() { if (!_instance) { _instance = this; } else if (this.gameObject.GetComponent <AudioSource>().clip != _instance.gameObject.GetComponent <AudioSource>().clip) { Destroy(_instance.gameObject); _instance = this; } else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Start() { rigid = GetComponent <Rigidbody2D>(); scoreUIP1 = GameObject.Find("Score P1").GetComponent <Text> (); scoreUIP2 = GameObject.Find("Score P2").GetComponent <Text> (); tutorial = GameObject.Find("Tutorial").GetComponent <Text> (); MediaPlayer = gameObject.GetComponent <AudioSource>(); ResetBall(); GameObject go = GameObject.FindGameObjectWithTag("MainMusic"); if (go != null) { mainMusic = go.GetComponent <MainMusic>(); } if (mainMusic != null) { mainMusic.PlayMusic(); } }
void Start() { _Main = FindObjectOfType <MainMusic>(); }
private void Awake() { instance = this; }