- Home /
Making a sound play at a moving point
Hi. I'd like to make sounds that play at a moving point. Currently I use
AudioSource.PlayClipAtPoint(sound,transform.position);
What should I use?
Comment
Best Answer
Answer by Antony-Blackett · May 28, 2011 at 04:03 AM
Use an audioSource component on a game object. then you go audio.Play() and the sound will move where ever the game object moves.
I did it a few days ago. Put a AudioClip variable in your script for each sound you want, and only one AudioSource. Assign the sounds to the AudioClip vars in the Inspector. At runtime assign the desired audioClip to audio.clip and start the sound with audio.Play():
var sound1:AudioClip = null;
var sound2:AudioClip = null;
var sound3:AudioClip = null; . . // in order to play sound2, for instance, do the following:
audio.clip = sound2; audio.Play();
Your answer
![](https://koobas.hobune.stream/wayback/20220612090959im_/https://answers.unity.com/themes/thub/images/avi.jpg)