|
Hi there, I'm currently trying to build a game that requires the character to pick up some items and I want a sound to play when an item is picked up. below is the code that I have so far
now the problem that I am facing is that the sound just stops because the item is destroy and I don't really want to yield it for a second. Is there any way that I can attach the sound to an empty gameobject and make that play instead when my character collides with the item ? or is there any way else to code this ?
(comments are locked)
|
|
This sounds like an ideal situation to use AudioSource.PlayClipAtPoint. This function does exactly what you want automatically - it creates a new audio source at the position specified, and cleans up the audio source afterwards, making it a "fire and forget" style function. To use it in your script, you'd change the code to something like this: thank you so much !! thats definitely what I was looking for
May 22 '10 at 12:24 PM
Fariz
(comments are locked)
|
|
I am having the same issue, but my problem is the camera is far from the player and I tweak my AudioSource ramp for each sounds. But with this, I have no choice to use the default setting..
(comments are locked)
|
