- Home /
Question by
nnorris523 · Mar 21, 2016 at 11:33 PM ·
triggerboxcollider2d2d collision
BoxCollider2D not triggering
I've been trying to figure this one out for quite some time (a bit of a Unity newb), hopefully you all can help me!
I've got a player 2D sprite with a Rigidbody2D as well as a BoxCollider2D, and I've got another sprite that I've called "DeathZone" which contains a BoxCollider2D with "Is Trigger" checked.
The following code doesn't log any message to the console when the two objects collide, which is worrying:
void onTriggerEnter2D(Collider2D other){
Debug.Log ("Something entered death zone.");
}
I've tried everything I can think of to fix this. Help!
Comment
Answer by Zoogyburger · Mar 21, 2016 at 11:33 PM
OnTriggerEnter2D is spelled with a capital O. Change your script to this:
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log("Something entered death zone");
}