/// <summary> /// AUdioSourceを生成する /// </summary> static void AudioSourceGenerate() { if (m_BgmAud) { return; } m_BgmAud = DontDestroyObject.Generate("BGM").AddComponent <AudioSource>(); m_BgmAud.loop = true; m_BgmAud.outputAudioMixerGroup = SoundManager.GetInstance().GetAudioMixerGroup("BGM"); }
private void Awake() { if (instance != null) { Destroy(gameObject); } instance = this; DontDestroyOnLoad(gameObject); }
private void Awake() { if (Instance != null) { Destroy(this.gameObject); return; } Instance = this; DontDestroyOnLoad(this.gameObject); }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
private void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Start() { DontDestroyOnLoad(this.gameObject); if (instance == null) { DontDestroyOnLoad(this.gameObject); instance = this; } else { Destroy(this.gameObject); } }