OnTriggerEnter and Exit is not being checked

Exactly what the title says, It doesn’t look like OnTriggerEnter and exit is being called i’m not sure whats going on.

using UnityEngine;
using System.Collections;

public class Sight : MonoBehaviour {

    public GameObject owner;
    private FighterController fc;
    void Start () {
    fc = owner.GetComponent <FighterController> ();
    }

    void OnTriggerEnter(Collider other) {
        if (other.gameObject.CompareTag ("fighter")) {
            fc.freemove = false;
            Debug.Log("found");
        }
    }
    void OnTriggerExit(Collider other){
        if (other.gameObject.CompareTag ("fighter")) {
            fc.freemove = true;
            Debug.Log("exited");
        }
    }

}

I have tried changing other.gameObject.CompareTag (“fighter”) to
other.tag == “fighter” and
other.gameObject.tag == “fighter”.

And i have also put Debug.Log(“—”) inside the body of OnTriggerEnter and is still not being called.
On the object with fighter tag i have tried checking the trigger box in collider component as well, still not working can you help me solve this problem thanks.

Just in case you ask, Yes i have set a fighter tag onto the object i want it to detect.

Are one or both colliders set to Kinematic=true?
Does OnCollisionEnter trigger?

Theres a nice overview at the bottom of this page Unity - Manual: Introduction to collision to see when what collision does trigger events. Maybe it could be helpful.

only one the objects has a rigidbody because the sight is a empty object

Well, please check the table I’ve mentioned (Collision action matrix) to take the guesswork out of it. There are just to many variations. :slight_smile:

I have tried giving sights object a rigid body and that didn’t work i don’t know why this is not detecting i have another scene with almost equal conditions which is working with triggerEnter. I think there’s something wrong with the script not the component because i have looked at the table and gave the sights object a rigid body collider and its still not detecting.

No, your script is correct. Two gameobjects with rigidbodys and trigger colliders will trigger the event.
I think you’re messing up with some invalid combinations of istrigger, kinematic, rigidbody, etc. and OnTrigger/OnCollision.

Problem solved i had to have a box collider on the sights object.

thanks for your help.