Нашел ответ:
все перемещения нужно делать через rigidbody velocity.
private void Move()
{
Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position + transform.up * 0.3f + transform.right * right, 0.1f, LayerMask.GetMask("Ground"));
if (colliders.Length > 0)
{
dir = -1f;
}
Collider2D[] colliders2 = Physics2D.OverlapCircleAll(transform.position + transform.up * 0.3f + transform.right * left, 0.1f, LayerMask.GetMask("Ground"));
if (colliders2.Length > 0)
{
dir = 1f;
}
rb.velocity = new Vector3(1f * speed * dir, 0, 0);
}