2D colliders not working

Hi,
This is my first post in unity forums, I’m not a mainstream programmer, but I was trying to code something in 2D the other day and the colliders in the scene wont work as they’re supposed to.
what I want to do is,
When I swipe in any direction(Up, Down, Right, Left only) the gameobject should move in that direction but in a grid like precision. I want to control the no. of units the object moves in one swipe. So I used a variable for the move limit and one for the size of unit movement. My swipe worked nicely, but when I placed another object with a collider in it’s path it won’t collide with it, instead it moves through the object to the target position. I tried, transform.Translate, Mathf.Lerp, tranform.position everything but the result is the same.
Both the objects have 2D colliders and just to be safe I gave both of the, rigidbody2D.
Please tell me how to solve this or an alternate way to move the object so they collide.

Thank you in advance

try to move rigidbody2d.

(i didnot tried it, in most case i am using rigidbody2d.velocity)

I did not know about this, thank you for the information sir.

Sir I tried this, But unfortunately it didn’t work. It works at really small distances but fails at a distance of 2 to 3 units. but still thank you and if you have any other suggestions please help

Have you put a debug in to see if it is detecting the collision at all?