tag distance script

hi, i have a distance script for a transform var... but i have the problem of only 1 var, and i need instantiated prefabs ect... how can i make a distance script that activates when any object with a certain tag is near... i need it to enable a script (GetComponent("gameOver").enabled = true;) thanks!!!! :D

You can use Physics.OverlapSphere to get all colliders that are in "range". Then you can check for a special tag name or what ever.

var allColliders : Collider[] = Physics.OverlapSphere(transform.position, 5.0);
for (var currentCollider : Collider in allColliders)
{
    if (currentCollider.tag == "MyTagName")
    {
        GetComponent.<gameOver>().enabled = true;
    }
}

I suggest that you attatch a sphere collider to the object, or make it a child. Set the collider to trigger, and in `OnTriggerEnter`, check if the object has the tag. if so, then execute your get component.