I keep bumping up against this issue... When I change targets things wouldn't disappear. So I added this:
Code:
local a = CreateFrame("Frame")
a:SetScript("OnEvent", function(_,event)
local pguid = UnitGUID("player") or nil
if pguid then
oUF_player.Container:Show()
else
-- Added If statements here to see if it still crashes on /reload while dead: untested.
if oUF_player.Container then oUF_player.Container:Hide() end
if oUF_target.Container then oUF_target.Container:Hide() end
end
local guid = UnitGUID("target") or nil
if guid then
oUF_target.Container:Show()
else
oUF_target.Container:Hide()
end
end)
a:RegisterEvent("PLAYER_ENTERING_WORLD")
a:RegisterEvent("PLAYER_TARGET_CHANGED")
All of my frames are anchored to the Container. This mostly works well enough for making all the graphics appear and disappear. But now if I go select target Thrall, who's marked pvp, then when I run away to deselect him, and then select myself, I show as flagged target, when I'm not flagged. My file contains a PvpOverride to change the icon, if that matters.
Also I added a left-click to show a frame with Thrall's 103 million hp. This frame is also anchored to the container. Same issue: After selecting and deselecting Thrall, then I select myself and I have 103million hp.
Is there any simple way to fix it so that it resets everything when a target is deselected, or I should make a (very long) list of each element of the layout and try to reset each separately?
Thanks!