Just can't get the OnTrigger2D to work

Just can’t figure out what I’m missing here. I’m trying to use the OnTriggerEnter2d method.

I have a projectile shooting out, and making contact with a moving rock.

Both objects have a circle collider2d and a rigidbody 2d.

I’ve tried adding this to one or even both objects, I’ve clicked the IsTrigger on the collider for one and even tried both objects.

void OnTriggerEnter2d(Collider2d other) //I’ve also tried (CircleCollider other)
{
Debug.Log(“Triggered.”);
}

The objects otherwise collide fine. Or don’t collide depending if I have IsTrigger checked.

I feel like there’s something straightforward I’m missing?

It’s pretty sad, but I’ll leave this up in case anyone else is noob enough to not notice, the

2D part in the OnTriggerEnter2D method name needs to be capitalized.

1 Like