UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionAudio in trigger EmptyAudio in trigger

more_horiz
Hi guys! I created this very simple script. When the player go in a Trigger zone audio.Play and when the player exit audio.Stop.
Script (Js)

Code:

function OnTriggerEnter(){

audio.Play(); }

function OnTriggerExit(){

audio.Stop(); }

descriptionAudio in trigger EmptyRe: Audio in trigger

more_horiz
I updated the script. After 4 seconds the object will it destroy.
SCript (Js)

Code:

function OnTriggerEnter(){

audio.Play(); }

function OnTriggerExit(){

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

descriptionAudio in trigger EmptyRe: Audio in trigger

more_horiz
Thanks for sharing and helping the community as usual!

descriptionAudio in trigger EmptyRe: Audio in trigger

more_horiz
MisterNinjaBoy wrote:
Thanks for sharing and helping the community as usual!

Of nothing! Very Happy

descriptionAudio in trigger EmptyRe: Audio in trigger

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply