How to use PlayClipAtPoint!
Objective: Learn and apply the function of PlayClipAtPoint.
PlayClipAtPoint is a function that plays an audio clip at a given position in the world. It creates an audio source, then automatically deletes it once the clip had played through.
All we need to use this function is an audio clip which you will need to precure.
And the position in the world, which will be on the object’s position.
With that mapped out, now you need to select where you want this audio to play, and add the code there.
The code will be the class, followed by the function, parenthesis, audio clip and position.
Now when this is called the audio will play even if the object is destroyed, and once the clip has played it destroys itself leaving nothing behind. Now you can instantiate audio in your games!