I have a problem with the OnTriggerEnter function.
I have a prefab which contains a model and a point light. This prefab is also a NavMeshAgent. I set the tag of this prefab to car. I then had a box which has the “IsTrigger” property checked. The box collider I have a script attached with the following:
private void OnTriggerEnter (Collider other) {
if (other.tag == "Car")
{
Debug.Log("Car entered");
}
if (other.tag == "Player")
{
Debug.Log("Player entered ");
}
}
When the Car prefab enters moves into the box collider, the debug message does not execute. However, if the FPSController (which is assigned the Player tag), I get the debug message. I thought that the problem could be a conflict of collision boxes within the Car prefab, so I disabled everything except the box collider, and I made sure to uncheck the “IsTrigger” property on the car. I still do not get any debug messages. is there a problem with using trigger boxes with NavMeshAgents?