I’m lost. I have the tag “Player” applied to my Player object. I want to use OnTriggerEnter to make a turret rotate towards it if a boolean variable InTrigger is activated. This only works on objects that are tagged Player but aren’t actually the Player object! I’ve tagged my shot “Player” just to see what would happen, and when I shot into the turret’s collider, InTrigger was activated and it rotated toward the target. But when I drove my Player into the collider in game mode, nothing happened. Please Help.
public bool inTrigger = false;
void OnTriggerEnter ( Collider other ){
if (other.tag == "Player"){
inTrigger = true;
}
}
I think the error is in the if(other.tag == “Player”) { line. When I mute this line, the script works because the object is in contact with the ground’s collider. Could it be a problem with my Player GameObject?