- Home /
Audio Needs to stop
Hey I'm trying to make a phone ring, I have the phone ringing and when I touch it the voice turns on all I need to do it make the ringing stop. Please help, either by Javascript or something else.
Answer by e-bonneville · Apr 12, 2010 at 10:57 PM
Use a trigger like this:
var Ringing : AudioClip; var Voice : AudioClip;
function OnTriggerEnter (other : Collider) { audio.Play("Ringing"); audio.Play("Voice"); }
This is Javascript. To use it, make a sphere. Then, remove the Mesh Rendering component, and change the collider to be a trigger. Then place this script on the trigger, and drag the ringing and the voice sound onto their respective positions in the Inspector. Then place the sphere so it surrounds the phone, representing the range you want your phone to have (how close/far you can be to make it go off). Hope this helps!
Your answer
Follow this Question
Related Questions
Play sound when out of ammo 0 Answers
Why is my random sound java script not working? 2 Answers
Stop audiosource clip from playing 1 Answer
Adjusting system audio levels... Please help! 1 Answer
Timer Scripting No Idea On Script 0 Answers