Originally Posted by MunkDev
Any suggestions on how to solve this, if it's even possible?
|
Lua Code:
local activeUnitPlates = {}
local function AddNameplate(unitID)
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
local unitframe = nameplate.UnitFrame
-- store nameplate and its unitID
activeUnitPlates[unitframe] = unitID
end
local function RemoveNameplate(unitID)
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
local unitframe = nameplate.UnitFrame
-- recycle the nameplate
activeUnitPlates[unitframe] = nil
end
local frame = CreateFrame("Frame")
frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
frame:SetScript("OnEvent", function(self,event,...)
if event == "NAME_PLATE_UNIT_ADDED" then
local unitID = ...
AddNameplate(unitID)
end
if event == "NAME_PLATE_UNIT_REMOVED" then
local unitID = ...
RemoveNameplate(unitID)
end
end
This is hopefully what are looking for!
I'm currently constructing new plates for my UI with animated health bars and such things...
The new system is freaking awesome, and very handy!