- Home /
Question by
Commander Quackers · Dec 08, 2013 at 12:45 AM ·
gunlinessimultaneously
Make two lines of code execute simultaneously?
So I have these two lines of code:
yield WaitForSeconds(ReloadTime);
audio2.Play();
How would I make those two lines happen at the same time, so while it is waiting for the reload time to pass, it plays the audio? Thanks!
P.s - somewhat new to scripting, learning fast
Comment
Answer by Eric5h5 · Dec 08, 2013 at 12:48 AM
Invert the order of the code, so audio2.Play() is first.
That makes it so that it plays too early, is there a way to delay it by a half second or so?
Invoke ("PlaySound", 0.5);
yield WaitForSeconds(reloadTime);
// stuff
}
function PlaySound () {
audio2.Play();
}
You can just use WaitForSeconds twice, once before you play the audio and once after
Your answer
Follow this Question
Related Questions
Animation & Script Help 2 Answers
RayCast Shooting not working 0 Answers
Gun Animate when it shoots 3 Answers