- Home /
Audio Help!
I am currently making a horror game, and I need sounds to play once, and then destroy, I asked this earlier, but I couldnt find the thread, this is my script
function OnTriggerEnter(other: Collider){
if (!audio.isPlaying){
audio.Play();
Destroy.audio();
}
}
I did not make this script. If this script is not right, please reply with a solution :)
Answer by daivd.ramz · Jul 28, 2013 at 07:08 AM
hi, do you want to play sound for next? and you must check your AudioSource, state loop in audiosource must be off and you can this work too
function OnTriggerEnter(other: Collider){
if (!audio.isPlaying && allow_play){
audio.loop = false;
audio.Play();
allow_play = false;
}
}
and if you want to play for next you can this work:
function OnTriggerExit(other: Collider){
if (!audio.isPlaying && !allow_play){
allow_play = true;
}
and for end can you explain more,maybe i can help you, please and excuse me for my bad english :)
Sorry, but neither of these worked, I have a feeling, that I might be putting the script in the wrong Javascript file, i'm putting it in the soundscript with had my script I have gotten about 3 other answers, and none of them worked, am I doing this right?. (I'm a Newbie) :(
can you send to me your javascript file? you can send it to my gmail: davood.ramz@gmail.com
Your answer
Follow this Question
Related Questions
How to play several audio cllips one after another. 3 Answers
Slowly fade audio's pitch on key press? 3 Answers
Audio after Audio Loop 1 Answer
Play audio on keyboard click? 1 Answer