Hey guys,
I always wondered what the default way is to playback audio Sound Effects, because my current way seems kinda overly complicated.
Here is how I do it currently:
I have a GameObject, with an AUDIO.js script. I link every AUDIO source from the scene in there like that:
var EnemyHitSound : AudioSource;
static var enemyHit = false;
And I set up the Update function like that:
function Update () {
if (enemyHit){
EnemyHitSound.Play();
enemyHit = false;
}
}
So when I want to play the Audiofile from any script I just write: AUDIO.enemyHit = true;
This seems like such a hassle and completely counter intuitive. Is there a more straight forward way of being able to play any Audio Source in the scene, from any script?
I really appreciate your help.
Thanks