Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » FREE Project Downloads & Recources » Scripts » sound trigger script

sound trigger script

View previous topic View next topic Go down  Message [Page 1 of 1]

1 sound trigger script on Fri Dec 26, 2014 1:37 pm

zino2k


Member [Lv. 2]
Member [Lv. 2]
hey gy this is sound trigger script enjoy


function OnTriggerEnter(){

audio.Play(); }

function OnTriggerExit(){

audio.Stop();
yield WaitForSeconds (4);
Destroy(gameObject);}

View user profile https://www.youtube.com/user/zinofxmovie/videos

2 Re: sound trigger script on Mon Jun 08, 2015 8:28 pm

Survivor


{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
This code is perfect for a jump scare because it plays the audio once only.

Also note that the number 4 in yield WaitForSeconds (4); is the length of the audio file.

View user profile

3 Re: sound trigger script on Thu Jun 11, 2015 3:10 pm

developer23


Moderator
Moderator
I already posted the same script:
Code:
function OnTriggerEnter(){

audio.Play(); }

function OnTriggerExit(){

audio.Stop();
yield WaitForSeconds (4);
Destroy(gameObject);}



Last edited by developer23 on Thu Jun 11, 2015 3:12 pm; edited 1 time in total

View user profile http://masterdevelopers.altervista.org/

4 Re: sound trigger script on Thu Jun 11, 2015 3:11 pm

developer23


Moderator
Moderator
Why you copied me?? You put also the same time to destroy the object...

View user profile http://masterdevelopers.altervista.org/

5 Re: sound trigger script on Tue Jul 07, 2015 6:44 am

surajVishwakarma


Member [Lv. 1]
Member [Lv. 1]
dont fight its Nice Code ...... Very Happy

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum