Відстань між об'єктами

(transform.position - target.transform.position).sqrMagnitude    // відстань в квадраті