#unity #ui #gamedev
Unity tutorial for dragging a ui element and not allowing it to be off screen!
In this video we will be going over a way to drag a ui element around the screen and clamping it within the screen. This works for Screen space overlay mode on the canvas and for screen space camera mode on the canvas.
The mouse will stop dragging the object if the mouse leaves the screen while dragging the object.
Just click and drag on the object to begin dragging!
Here is the link to the whole project:
https://github.com/AMiller90/YTTutorials/releases/download/UnityTutorial8/DraggableUiTutorial.zip
Here is the link to the draggable ui file if you want just the file:
https://github.com/AMiller90/YTTutorials/releases/download/UnityTutorial8/DraggableUi.cs
I hope you all enjoy!
Download
0 formats
No download links available.
Unity Draggable UI Elements and clamp within screen! | NatokHD