Originally Posted by p3lim
The function that you pass as a parameter to oUF:SpawnNameplates only fires when a new nameplate is created OR when a nameplate becomes the new target.
|
Minor correction, it's called whenever a nameplate is added (either created or shown again), removed (hidden), or when it becomes the new target.
Originally Posted by siweia
I have no idea why I need to update it in two places to make it work.
|
Well, it works because you update every single nameplate when
PLAYER_TARGET_CHANGED fires, you can actually remove
UpdateTargetMark from your spawn callback.
-- edit #1
aallkkaa's solution is a good one if you want to use only spawn callback. You need to update old target and new target nameplates, so you have to track the old target.
On a side note, we could probably remove
PLAYER_TARGET_CHANGE handling from oUF nameplate driver entirely and make layout devs handle it on their own.