- Home /
Question by
HowDoIDoTHIS · Aug 10, 2012 at 08:31 PM ·
collisionaudiosound
Making a sound using collisions
I'm completely new here. I tried looking up various tutorials but it doesn't help. I have a script somewhat it doesn't do anything as of right now. Please no professional stuff that will make me just do a copy and paste. I get no error it doesn't play a sound. also I don't even know if I'm even making a correct trigger collision area. I copy and pasted a floor block and checked off is trigger, dragged on both the script and the sound on the same block. Here's a video if it helps Thanks for reading! I made the audio file a .ogg
var HallwayScare : AudioClip;
function OnCollisionEnter (collision : Collision) {
audio.PlayOneShot(HallwayScare);
// audio.Play(HallwayScare);
}
//@script RequireComponent(AudioSource)
Comment
Answer by nixtwiz · Aug 11, 2012 at 01:15 AM
Here's a similar question, just follow its answer. Remember to search the questions here before asking :)