void Awake() { if (bgmInstance == null) { bgmInstance = this; } else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
//追加9/17 private void Start() { checkPoint = GameObject.FindGameObjectWithTag("Player").GetComponent <CheckPoint>(); enemies = GameObject.FindGameObjectsWithTag("Enemy"); bgmScript = GameObject.FindWithTag("MainCamera").GetComponent <BGMScript>(); enemyNum = enemies.Length; enemyRobot = new EnemyRobot[enemyNum]; Debug.Log(enemyNum); for (int i = 0; i < enemyNum; i++) { enemyRobot[i] = enemies[i].GetComponent <EnemyRobot>(); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
// Use this for initialization private void Awake() { if (bgmInstance != null) { Destroy(this.gameObject); return; } else { bgmInstance = this; } DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Start() { if (BGM == null) { BGM = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); }
void Awake() { if (!instance) { instance = this; DontDestroyOnLoad(gameObject); audioSource = GetComponent <AudioSource> (); audioSource.loop = true; originalVolume = audioSource.volume; } else { Destroy(gameObject); } }
// Use this for initialization void Start() { Current = this; aud = GetComponent <AudioSource>(); }
// Start is called before the first frame update void Start() { bgmScript = GameObject.FindWithTag("MainCamera").GetComponent <BGMScript>(); }