RegisterAttributeDriver() is just handling what unit is selected when you click on the frame and should handle
RegisterUnitWatch() fine on its own. It's just a more direct approach to what you were already doing. The display code, you can do whatever you want and it isn't going to hurt the SecureUnitFrame. The problem is still located there. Try taking the code back to the basics and replace the 4 vehicle event blocks with this. Don't forget to unregister
UNIT_ENTERING_VEHICLE and
UNIT_EXITED_VEHICLE.
Lua Code:
function Player:UNIT_ENTERED_VEHICLE(unit, showVehicleUI, arg3, vehicleType, vehicleID, arg6, vehicleGUID, arg8, arg9)
if showVehicleUI then
self.frame.unit = "player"
self:UpdateDisplay()
end
end
function Player:UNIT_EXITING_VEHICLE()
if self.frame.unit ~= "pet" then
self.frame.unit = "pet"
self:UpdateDisplay()
end
end
(Code taken from Player.lua and modified)