Question by
g33kcub · Oct 25, 2015 at 04:57 PM ·
scripting problemaudioaudiosourceaudioclip
Newbie with OnTriggerEnter & Audio Files
Ok, so basically I am trying to figure out how to get an object to play a sound overtime someone gets near it. I tried several videos and they all say to use "audio.play", but in Unity 5 that is no longer correct. So here is what I'm using and it seems to fail and I'm to much of a new to figure it out on my own.
#pragma strict
var soundFile:AudioClip;
function OnTriggerEnter(trigger:Collider) {
GetComponent.<AudioSource>(soundFile);
}
Any ideas what I'm doing wrong. I'm sure it's obvious, but I'm still learning, lol.
Comment
Your answer
Follow this Question
Related Questions
Audio or Music continuing to play between scenes 1 Answer
Second AudioClip won't play 0 Answers
How to stop current audio before another audio starts? 0 Answers
How to reduce delay when playing sound 0 Answers
Some sounds won't play 0 Answers