How can i code a sound to play on trigger?
void OnTriggerEnter(Collider other)
{
if(other.tag == "player")
{
audio.Play();
}
}
This is assuming the audio source is located in the same object you attach the script to.
thanx!
How can i code a sound to play on trigger?
void OnTriggerEnter(Collider other)
{
if(other.tag == "player")
{
audio.Play();
}
}
This is assuming the audio source is located in the same object you attach the script to.
thanx!