Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

API UnitName

Last wiki revision 2022-08-24

Returns the name and realm of the unit. name, realm = UnitName(unit) = UnitFullName(unit) = UnitNameUnmodified(unit)

  • unit: : UnitId - For example or
  • name: - The name of the unit. Returns if the unit doesn't exist, e.g. the player has no target selected.
  • realm: - The normalized realm the unit is from, e.g. . Returns if the unit is from the same realm.
  • Will return globalstring "Unknown Entity" if called before the unit in question has been fully loaded into the world.
  • The unit name will change if the unit is under the effects of Lifegiving Seed or a similar effect, but is unaffected by this.
  • Prints your character's name.
  • Prints the name and realm of your target (if different).
  • is equivalent with except it will always return if used with the "player" UnitId.

GetUnitName can return the combined unit and realm name.

  • If is true and the queried unit is from a different server, then the return value will include the unit's name appended by a dash and the normalized realm name.
  • If is false, then will be appended to units from coalesced realms. Units from the player's own realm or Connected Realms get no additional suffix.

Unit is from the same realm.

Unit is from a different realm but the same Connected Realm (LE_REALM_RELATION_VIRTUAL).

Unit is from a different, non-connected realm (LE_REALM_RELATION_COALESCED).

Source

https://warcraft.wiki.gg/wiki/API_UnitName · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.