Drag interactions break when drop target gets dragged

Hey there.

I have two Characters who are Container Game Objects and need to fight each other. These characters should move on a grid-based map. I can drag one of the characters over the other, to get a battle preview.

The logic flow is as follows:

  • I click on Character A. Inside the pointerdown callback, I setInteractive(undefined, undefined, false) on said character. I also send a request to my server that finds out that Character B is in range and can be fought, so I setInteractive(undefined, undefined, true) on B.
  • I drag A over Character B. The game correctly detects that I’d like to simulate a battle between A and B, since A has received a “dragenter” event with B as its target.

However, a funny thing happens. If I proceed to click on B, and proceed to drag it even a little bit, B receives a dragenter event, with the target being… B itself. It’s as if the setInteractive(undefined, undefined, false) never ran.

To make sure this wasn’t an issue with my logic, I made a test, where on pointerdown, the character would setInteractive(undefined, undefined, true) unconditionally. And what happened was, that while I could drag the character around, it would receive a dragenter event, with itself set as a target.

Thanks in advance, I’d really appreciate some help since this is a core UX feature of my game, and I would have to hack workarounds all over the place if I can’t find any solution for it.