I’m trying to make music zones, enter a music zone and it will play music according to the area. I want it all in one script. I figured out how to do it with tags, but I think I’m doing it terribly wrong :(. ALSO! It’s supposed to play the music in the main camera. How can I do that?
#pragma strict
var MusicZone1Adventure : AudioClip;
function Start () {
}
function Update () {
}
function OnTriggerEnter() {
if (gameObject.tag == "MusicZone1Adventure") {
audio.PlayOneShot = MusicZone1Adventure;
}
}
Can anyone point out what I’m doing wrong? Thanks in advance!