I am trying to disable a script and change its colour of enemies that are entering the trigger, but I can not seem to find a way to do this.
Here is the code of what I have tried so far:
function OnTriggerEnter (collide:Collider){
if(collide.gameObject.name == "enemy1R2" && doOnce == true){
Debug.Log(collide);
collide.gameObject.renderer.material.color = Color.yellow;
collide.gameObject.GetComponent("AI_nm1").enabled = false;
doOnce = false;
}
}