Audio OnTriggerEnter not working
Hi there, I'm trying to set up a 360 sound experience where there are different sounds placed in a scene and triggered when the player moves into their collider space.
I have created the trigger objects as 3d shapes and attached a trigger sfx script to each of them that includes this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TriggerSFX : MonoBehaviour
{
public AudioSource triggerSound;
private void OnTriggerEnter(Collider other)
{
triggerSound.Play();
Debug.Log("Sound " + triggerSound.name + " played");
}
}
I have attached a trigger sound to it and then when I hit play and walk right through the target nothing happens, no audio played and no message in my deb console. Wondering if there is anything else i need to add to this code like getCompoenent? etc
Your answer
Follow this Question
Related Questions
Cannot Play audio clip using OnTriggerEnter C# 0 Answers
Im trying to turn off a sound when i leave a trigger collider 0 Answers
having problem with 'else' did i put it in the wrong place? 1 Answer
Audio Fade In / Fade Out with Trigger 0 Answers
Is there any feature to play click sound on every button in scene? :) 0 Answers