Boolean wont acitvate if the enemy enters a trigger

Hello I have a Script this script is very simple i have a enemy and i have a boxcollider called waypoint. When the AI (enemy) enters the trigger a boolean should be true. But its not happening. the AI has the tag Enemy on it. So… here is my script

#pragma strict

var enter : boolean = false;
var Enemy : GameObject;

function OnTriggerEnter (poppen : Collider) {

     if(poppen.collider.tag == Enemy.tag)
     enter = true;
}

When using any kind of collider, be it a mesh collider, box collider, capsule, etc, one of the colliding objects must also have a RigidBody component. If you need collision but don’t want physics, simply check the IsKinematic box. I’m just making an assumption here, so hopefully this is the problem.

Your code looks fine, and you don’t need to hardcode “NameOfTag”. That is bad. If Enemy.tag is “NameOfTag”, then if(poppen.collider.tag == Enemy.tag) will return True if poppen.collider.tag is also “NameOfTag”. So, make sure the tags are set, and that the gameobjects have rigid body components. Good luck!