Detect collisons only on the border of a collider,How to detect collisions only on the border of a collider but not inside?

I am creating a 2D game and i want to implement two game objects with circular colliders to detect collisions as follows.
Suppose an object is travelling from Point A to Point B then

See the image for details.

Thanks for the help

Just using OnCollisionEnter2D and OnCollisionExit2D will almost get what you want and is easy to set up. The only problem is that OnCollisionExit2D will only be called once the object has fully left the other object. I would suggest having a second smaller collider and detect when you’re also inside that and stop doing whatever it is you’re doing when that happens. Also, I haven’t done any 2D stuff, but you probably want to use triggers, not colliders (i.e. check the “is trigger” checkbox on the colliders and use OnTrigger[Enter/Exit/Stay]2D)