OnTriggerEnter

Hey all,

This is such a noob question, I have used this code before I even copied it from another project I was working on.

var target : Transform;    

function Start () {    
}

function Update () {    
}

function OnTriggerEnter (trig : Collider){
	if(trig.gameObject.tag == "enemy"){
			Debug.Log("Detected!");
	}
}

It’s not rocket science is it? But this is attached to a sphere with a trigger, and I have another object Tagged enemy. But it simply will not Debug.

This is probably a school boy error but I can’t make it work. please help!

Steve

Hi MrSteave1
Collision or Trigger detect when only one of the object have rigid-body, so please add rigid-body component any of the one game object…