Audio. How to play a sound file when triggered by collision?

Hi All

I’m a total beginner. I’ve no experience of scripting. I’ve looked through a few tutorials and still not sure what I’m doing.

In the image I’ve made a ramp. I want an audio file to play if the player falls off the ramp and triggers the box collider below. I’ve attempted a script but it doesn’t work when I play. Any advice greatly appreciated…

#pragma strict

var myClip : AudioClip;

function OnTriggerEnter (myTrigger : Collider) {

 if( == "First Person Controller"){


You would need an AudioSource component on that same object for audio.Play… to work. Or make another object with and AudioSource, set the clip to it, get that object, tell its audio to play.

Thanks so much Dave