Activing only one instance of a prefab

Hi guys
Im pretty new to unity and am having a bit of trouble with activating a script on my prefabs. I have an enemy prefab, the enemy’s control script is activated when the player collides with a trigger around the enemy. This is working fin, I enter the trigger and the enemy will chase me. The problem I’m having is with using multiple enemies, when the player enters 1 of the triggers to activate an enemy every enemy in the level activates as well.

What I’m looking for is a way to change the activate variable in the instance of the prefab that the trigger belongs without effecting any other instances of the same prefab.

Any help you can offer would be greatly appreciated

It seems your problem is the way you’re activating the enemy script - are you using some static variable? You should post your script.

Anyway, I would do the following: create the trigger volume, then child the enemy to it, and activate its script (let’s call it EnemyScript.js) in OnTriggerEnter:

function OnTriggerEnter(col: Collider){
  if (col.tag == "Player"){
    var script: EnemyScript = GetComponentInChildren(EnemyScript);
    if (script) script.enabled = true;
  }
}

This ensure that only the enemy childed to the trigger will have its script enabled.