why onCollisionEnter2D doesn't work when i use OnMouseDown or Up?

hi
in android I make a game, and use OnMouseDown & UP for drag my object(player). there are some enemy that when player collide them it die. but when i drag player(on mouse down) to enemy collider, Oncollision2D doesn’t work. please help me how to solve it. thanks.

I am guessing that this is because you are copying the mouse transform when moving it. Collisions will only be registered if at least one of the objects has a non kinematic rigidbody that is active. Try using something like playerRigidbody.AddForce(player.transform.position - mouse.transform.position) to pull the rigidbody player towards the mouse instead of just copying the transform. Another thing that might work is using OnCollisionStay() instead, because that should trigger as long as there is an overlap and the player’s rigidbody is active.