Returns the squared distance to a unit in the player's group. The distance returned appears to work from anywhere (even across continents and instance boundaries, although the answer is of dubious value).


See also Map functions.

Signature:

distanceSquared, checkedDistance = UnitDistanceSquared("unit")

Arguments:

  • unit - A unit in the player's party or raid (string, unitID)

Returns:

  • distanceSquared - Distance to that unit, squared (number)
  • checkedDistance - true if the distance result is valid, false otherwise (eg. unit not found) (boolean)