Lua Code:
local GetNamePlateForUnit = C_NamePlate.GetNamePlateForUnit
local previousTarget
local function OnTargetChanged()
local parent = GetNamePlateForUnit('target')
local currentTarget = parent and parent.unitFrame
if currentTarget == previousTarget then return end
if previousTarget then
previousTarget:SetBackdropBorderColor(0, 0, 0)
previousTarget = nil
end
if currentTarget then
currentTarget:SetBackdropBorderColor(1, 1, 1)
previousTarget = currentTarget
end
end
oUF:SpawnNamePlates('MyStyle', OnTargetChanged)
I use this code above and don't have any issues