[2D] Creating a snap-on-Grid effect

Hi,

So I am creating an UI wich lets the user push blocks around a grid.
For that I want to create an effect that if you hover a block over the Grid and release the mouse it automatically snaps to the next free spot.
Im new to Unitys UI system and dont know of theres a tool for it and if there isnt, has anyone an idea to share?
thanks

Hello Feodor,

I don’t know if that would help but on the last Unity UIToolkit project you can see how they handle Drag’n’drop with UI element to 2D / 3D scene.

The project is available there :

And the script I’m talking about is this one

You can see the method “CardDragged” that does that.

I don’t know if that helps?

Have a great day.

1 Like

Thanks I’ll take a look at it