hey guys, my brain has shut down and I need help with controlling some audio in my environment. Basically I have another script which is defining events and I want different audio clips to play depending on the event. They are day and night events.
Heres what I have, but it doesnt work.
using UnityEngine;
using System.Collections;
public class soundsDay : MonoBehaviour {
public static bool nightTime = false;
public AudioClip daySound;
public AudioClip nightSound;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (nightTime == false){
audio.clip = daySound;
audio.Play();
}
if (nightTime == true){
audio.clip = nightSound;
audio.Play();
}
}
}
Any help would be greatly appreciated and referenced to in my end product.