Unity 3D- on trigger enter or exit play stop sound
Publié : mar. mars 11, 2014 1:04 am
On trigger enter, play or stop sound
Code : Tout sélectionner
function OnTriggerEnter(otherObj: Collider){
if (otherObj.tag == "Player"){
audio.Play();
}
}
function OnTriggerExit(otherObj: Collider){
if (otherObj.tag == "Player"){
audio.Stop();
}
}