Calculating the range to a target and getting some bizarre results with transform.position not matching in editor position and throwing out the range calculations?
in Unity 2018.1.0f1.
Vector3 distance = (target.position - transform.position);
Debug.Log("Target Pos["+target.position+"] Pos ["+transform.position+"] Distance ["+distance.ToString()+"]" + distance.magnitude);
if (distance.magnitude < 5f)
Note the object moving is being moved by a Nav Agent component on a navmesh.