- Home /
 
 
               Question by 
               hirenkacha · Aug 08, 2012 at 12:32 PM · 
                audioaudioclip  
              
 
              Play a multiple audio sources sequentially
Hi all, I want to play a car sound
first start.mp3 (once), when level is loaded.
second acceleration.mp3 (once), after start.mp3 has finished playing.
Third engine_idle.mp3 (in loop), after acceleration.mp3 has finished playing.
Last stop.mp3 (once), when level is finished.
How to play this in the sequence, i could not understand. Please help..
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by hirenkacha · Aug 31, 2012 at 07:00 AM
I found my solution by this, where I have multiple audio sources attached to the car.
 public AudioSource[] sound;
 
 void Start()
 {
    sound=GetComponents<AudioSource>();
 }
 
 void Update ()
 {
 if(flag1)
 {
    sound[0].Play();
 }
 if(flag1 && !sound[0].isPlaying)
 {
    sound[1].play();
 }
 }
 
              Answer by create3dgames · Aug 10, 2012 at 08:11 PM
Check out the car racing example from Unity Technologies. Download it in the Asset Store or online at http://unity3d.com.
Your answer