Check the "IsTrigger" button in the inspector on your collider component.
Your tag suggests it's a 2D game.. so:
void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.tag == "YourTag") {
Debug.Log("Its a hit!");
}
}
but!, for 3D:
void OnTriggerEnter(Collider other) {
if (other.gameObject.tag == "YourTag") {
Debug.Log("Its a hit!");
}
}
and if you want to check whether is has left the trigger change "Enter" to "Exit"!
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnTriggerEnter2D.html
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnTriggerExit2D.html
Good Luck!
Trending Articles
More Pages to Explore .....