Sound Effects and music

Hello. How can I add a sound effect to lets say when I pick up an object or get hurt, it will play a particular sound effect. Also how can I add music do the background when playing a game. Thanks.

Could take a look here. Sound.

Anyways to answer your first question. I think you would attach an audio source to your item that is going to be picked up. Then when that item is being picked up/triggered. Play the sound like this.

// Call this function when this item is being picked up
var pickingUp : AudioClip;
function PickedUp()
{
    // Play once
        audio.PlayOneShot(pickingUp);
}

For music in background i think you can add a audio source to the camera and have it play on awake and loop it. Not too sure about that one. But hope it helps. :smile:

http://www.freesound.org is what i typically use for testing .