Highlights don’t reappear if you set the same highlight you just cleared.
function onPickUp()
self.Book.setHighlight(0.2, 0.2, 0.8, 0.8)
end
function onDrop()
self.Book.clearHighlight()
end
This code will show the highlight on the first pick-up, but not on subsequent pick-ups unless the highlight is set to something different first (ie. by another part of code or by the user clicking and dragging)
If I had to guess, under the hood, setHighlight()
is skipped if there’s already a highlight in the exact same spot, and clearHighlight()
makes the highlight invisible without actually updating where it is, so setHighlight()
sees there’s already a highlight exactly where it wants to go, and skips itself without realizing the old highlight is invisible.
My workaround:
Use self.Book.setHighlight(2, 2, 2, 2)
instead of self.Book.clearHighlight()
, which just places the highlight offscreen