Hey everyone! So I’m creating a simple spider solitaire game, and I would like to know how to, when I drop a widget it would attach to the grid panel (location (rows, columns) would be based on the mouse position).
I tried to make it working, but it will not even attach to the grid.
You could derive the coords mathematically but a much more flexible & future-proof approach would be to populate the grid with user widgets. Think of those widgets as slots where another, dragged widget can be deposited.
Here, it would be the slot widgets’ job to detect the drop while the grid simply holds the slots. You could actually skip the grid widget altogether and simply place slots in a grid-like pattern…
As a bonus, you could now have a uniquely shaped grid without any need for laborious coord calculation. And each slot can handle the desired behaviour, including dragged UI element interaction.
I tried to make it working, but it will not even attach to the grid.
If you prefer to carry on this way, perhaps you could show the offending, misbehaving script. I am assuming you’re using this somewhere, right: