- Home /
Check any audio isPlaying
Hi guys, is there a way to find out whether any audio is playing?
var otherClip : AudioClip;
function Update (){
if (!audio.isPlaying){
audio.clip = otherClip;
audio.Play();
}
}
This works only when the script is attached to the gameobject that contains the audio source. If I want to target to another script in another gameobject, i can do this.
if (gameObject.Find("text01").audio.isPlaying) {
dosomething();
}
But what i really want is to check if any sort of audio is playing in the scene. It can be playing from any gameobject with a audio source attached. If there a way to check it? Sorry for the long winded question. Trying to get my question across as clear as possible. Thanks guys!!
Rgds, James
maybe you can find all the objects that have an AudioSource[] and then use a for to check if a AudioSource is playing
Your answer
Follow this Question
Related Questions
How to know if Audio is Paused? 2 Answers
AudioSource.IsPlaying returns true when only playing one shot? 0 Answers
Audio is always playing 0 Answers
audio.isPlaying always returns false 2 Answers
PlayOneShot returns false for isPlaying 5 Answers