OnCollisionEnter2D problem

Hello there!
As a practice in unity I’m trying to implement Arkanoid (breakout) game. I’ve created an EdgeCollider2d on awake for the 3 sides (walls and top according to the camera viewport) and also have GameObject Ball that has RigidBody2d (Dynamic) and CircleCollider2D and moved with rigidBody2D.MovePosition.
And I have the next problem. When the ball hit the wall near the top the first hit (wall hit) triggers the OnCollisionEnter2D but the next one (top hit) - doesn’t. I think that it is because of small amount of time between two hits. But I’m not sure and do not know how to fix it. I’ve tried different settings - triggers, Dynamic/Static/Kinematic, FixedUpdate for movement, Update with Time.deltaTime

So, will be very appreciated if anybody has any suggestions

Why are you using MovePosition? MovePosition is you explicitly setting its position which is mostly used for Kinematic motion. Such a game as yours, you’d set the velocity to start the ball moving, maybe even ensure the velocity magnitude (speed) is kept at a constant rate and let it contact stuff.

If the edge is a single collider then you won’t get an OnCollisionEnter2D for each edge, that wouldn’t make sense. You can this call when it first makes contact then you get OnCollisionStay2D if the contact or contacts persist followed by OnCollisionExit2D if there are no contacts.

Thank you a lot, I’ve solved my problem with the OnCollisionStay2D and conditions!