How to catch when object touches other object?

Hello everyone, I have this simple problem: I have object with Character Controller component, that acts as NPC, and I want to know when it touches a certain object. I made script and tried to override functions OnTriggerEnter and OnTriggerStay, but they are not working with objects, only with player object. I tried checking other.name and other.tag, but only NPC itself and Player tag seems to call that function.

How do I make simple box collider to call OnTriggerEnter?

My script looks like this. It is attached to empty object with Box Collider with Is Trigger checked. Object I want it to catch colliding has also Box Collider component and has tag set to “customObject”.

public class NPC : MonoBehaviour
{
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "customObject")
        {
            print("works");
        }
    }
}

Hi! You have to make sure you are using the right colliders against each other, or the collision won’t be detected. Check the collider matrix at the bottom of Unity - Manual: Mesh Collider component reference .

I’ve had trouble getting character controller to work before as well, but when i used a ridgidbody + collider instead, it worked fine. Give it a try.