Returns information about the spell currently being cast by the specified unit.
name, text, texture, startTimeMS, endTimeMS, isTradeSkill, castID, notInterruptible, spellId = UnitCastingInfo("unit")
- string - The UnitId to query (e.g. "player", "party2", "pet", "target" etc.)
- string- The name of the spell, or nil if no spell is being cast.
- string - The name to be displayed.
- string- The texture path associated with the spell icon.
- number - Specifies when casting began in milliseconds (corresponds to GetTime()*1000).
- number- Specifies when casting will end in milliseconds (corresponds to GetTime()*1000).
- boolean - Specifies if the cast is a tradeskill
- string (GUID) - The unique identifier for this spell cast, for example
- boolean - if true, indicates that this cast cannot be interrupted with abilities like or . In default UI those spells have shield frame around their icons on enemy cast bars.
- number - The spell's unique identifier. (Added in 7.2.5)
The following snippet prints the amount of time remaining before the player's current spell finishes casting.
local spell, _, _, _, endTime = UnitCastingInfo("player") if spell then local finish = endTimeMS/1000 - GetTime() print(spell .. " will be finished casting in " .. finish .. " seconds.") end
- For channeled spells, displayName is "Channeling". So far displayName is observed to be the same as name in any other contexts.
- This function may not return anything when the target is channeling spell post it warm-up period, you should use UnitChannelInfo in that case. It takes the same arguments and returns similar values specific to channeling spells.
- In Classic only casting information for the player is available. Use the CastingInfo API, which is essentially the same as UnitCastingInfo("player")
- Patch 8.0.1 / API changes (2018-07-17): Removed the second parameter, "nameSubtext". Second parameter is now "text" (former third parameter).
- Patch 7.2.5 / API changes (2017-06-13): The castID return value is now a GUID. Previously it represented the number of spell casts since the game was started.