Originally Posted by Resike
However sometimes from UNIT_ENTERING_VEHICLE to UNIT_ENTERED_VEHICLE and from UNIT_EXITING_VEHICLE to UNIT_EXITED_VEHICLE, the pet frame instead of showing the player or the pet shows the vehicle frame for a second for no reason. I'm not sure how to dodge that securely.
|
My guess is you're trying to swap the artwork before the game as officially applied the changes between vehicle and player modes. Have you tried limiting all the visual stuff to
UNIT_ENTERED_VEHICLE and
UNIT_EXITED_VEHICLE? From what I can tell, the
UNIT_*ING_VEHICLE events trigger hiding the old UI and
UNIT_*ED_VEHICLE events trigger showing the new one. At least that's how the default UI handles it.
Also, if you're using the
SecureStateDriver system, they don't necessarily listen to these events and are delayed by at least 200ms. You might be able to hook into the
OnAttributeChanged script to act on when
RegisterUnitWatch() triggers. If you leave it to show/hide the frame itself, it changes the
statehidden attribute to a
true/nil value.
At this point, I'm just running off a list of what could be going on. I don't see what
self:UpdateDisplay() is doing or how unit switching is being handled not only from the artwork aspect, but how the
SecureUnitButton template is being used. All that's being shown is debug code that isn't really going to work in the end product.