I’m making a (2D) game and I can’t figure out why the collision detection isn’t working.
I’m instantiating a bunch of prefabs and trying to detect when they collide. The prefab has a polygon collider 2D (with “is trigger” OFF) and a non-kinematic rigidbody 2D. Here’s the code I have attached to the prefab, currently just to test that the event is even firing:
function onCollisionEnter (collision: Collision) {
print("hit");
}
“hit” never prints when the two objects collide. What am I doing wrong??