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.