you have to use 2D game object with 2D colliders only. I think you are using 2D and 3D objects, if not then uncheck IsTrigger
and then your OnCollisionEnter2D
will work else if you want to make that IsTrigger
checked then use OnTriggerEnter2D
function.