August 2018
Intermediate to advanced
794 pages
28h 4m
English
Similar to PlayOneShot() is the PlayClipAtPoint() AudioSource method. This allows you to play a sound clip for an AudioSource created at a specific point in 3D World Space. Note that this is a static class method – so that you don't need an AudioSource component to use this method – an AudioSource component is created (at the location you give), and will exist as long as the AudioClip sound is playing. The AudioSource component will automatically be removed by Unity once the sound has finished playing. All you need is a Vector3 (x,y,z) position object, and a reference to the AudioClip file to be played:
Vector3 location = new Vector3(10, 10, 10); AudioSource.PlayClipAtPoint(soundClipToPlay, ...
Read now
Unlock full access