View Single Post
03-14-18, 01:59 PM   #12
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by p3lim View Post
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 View Post
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.
__________________

Last edited by lightspark : 03-14-18 at 02:29 PM.
  Reply With Quote