void OnTriggerEnter() working like void Start()

Hi Guys! I’ve got a very frustrating problem… I’m making a trigger for sound effect.
Script is simple,

void OnTriggerEnter()
{
  audio.Play();
}

But it don’t works, unity reads that like “void start” because audio is playing on start of the level and actions beetwen the “{, }” are on the start of the level. Is it bug? Help me! :stuck_out_tongue:

Sry for my english.

PS: audio is set “play on awake = false”

You need a collider for this trigger so it can compare it with something. maybe this causing the failure of the function?

void OnTriggerEnter(Collider other)
{
        if(other.gameObject == "Player")
               audio.Play();
}

I find out… the problem was that, the bench’s mesh collider collided with the box collider, and the bech was “OnTrigger”. It’s weird :smile: Ok, anyway - thanks for help :wink: