snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.63k stars 290 forks source link

[Bugfix] Drag Event Handlers Executing for Draggables not Really Being Dragged #968

Closed CG-Tespy closed 3 years ago

CG-Tespy commented 3 years ago

Description

Fixes a bug where drag events can be invoked even when a draggable isn't actually being dragged by the player

How to Reproduce the Bug

Open the DragAndDrop example scene, and try moving the DraggableSprite using editor controls, instead of the usual way. Move it onto the DragTargetSprite, and then off of it; both DragEntered and DragExited will execute.

What is the new behavior?

Thanks to a bool implemented in Draggable2D (and drag events altered to take it into account), DragEntered and DragExited only execute for draggables actually being dragged (be it by the player, or code meant to simulate the act).

Important Notes

Other information

stevehalliwell commented 3 years ago

Thanks for the PR. Looks like the history has some old commits in it so I'll squash it during the merge.