Audio Repeating
So I'm making a basic pacman game for my project in university and I'm having trouble with the audio sounds when pacman is eating the pacdots.
I have 2 questions which are:
1) What should I attach the sound source to? I have tried adding the sounds to pacman when he eats a pacdot but I'm not sure if that's the correct way to go.
2) Because you're eating a pacdot every 0.5s it tries to play the audio sound again straight away without the previous one playing (you would eat about 5-10 pacdots until the first sound would finish playing). So it just sounds like a machine gun as the audio just keeps repeating without any real sound coming out. Is there a way to play the next audio WHEN the previous one has ended?
edit: I put the soundtrack on a loop and to play on awake but as the sound track is about 1-2 seconds long there is a slight pause delay between each sounds. unlike the original pacman where it plays constant. (I saw a post about the audio being .wav and it didnt solve the problem)
Answer by Ali-hatem · May 09, 2016 at 06:47 PM
 if (!audio.isPlaying){
 audio.play();
 }
 
               see doc for more info AudioSource.isPlaying
Your answer
 
             Follow this Question
Related Questions
How to mute sounds that are coming from game objects not in camera 1 Answer
Throwing a sword 2 Answers
How to choise canvas render mode? 0 Answers
Enemy target reference issue 0 Answers