Returns whether a unit exists. A unit "exists" if it can be referenced by the player; e.g. party1 exists if the player is in a party with at least one other member (regardless of whether that member is nearby), target exists if the player has a target, npc exists if the player is currently interacting with an NPC, etc.

See also Unit functions.


exists = UnitExists("unit") or UnitExists("name")


  • unit - A unit to query (string, unitID)
  • name - The name of a unit to query; only valid for player, pet, npc, and party/raid members (string)


  • exists - 1 if the unit exists, otherwise nil (1nil)