Uploaded November 2021 | Updated November 2026, 1 day ago
This video shows an easy yet extendable way to implement drag and drop using the new input system in unity.
๐ฅ Get the Source Code ๐ฅ
patreon.com/posts/58031139
๐ค Support Me ๐ค
Patreon: patreon.com/samyg
Donate: ko-fi.com/samyam
โบ๐ Relevant Video Links ๐
แ Camera.ScreenPointToRay
docs.unity3d.com/ScriptReference/Camera.ScreenPointToRay.html
โบGet Object from Mouse Click and Call Functions through Interface 2D & 3D - Unity Tutorial
youtube.com/watch?v=JID7YaHAtKA
โบHow to use Unity's Input System
youtu.be/m5WsmlEOFiA
In this video we use Unity's new input system to implement dragging and dropping of both a 3d object and 2d object (2d collider). We use raycasts to get our object ScreenPointToRay, which takes into account the camera perspective easily, and then start a coroutine where we check each frame to see in what direction to move in. I'll show you how to implement this with physics to allow the object to stop when colliding with others, and also fall when released. I also show you how to use an interface to perform other actions once we've begun and ended dragging a gameobject.
Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we have recommended. While clicking these links won't cost you any money, they will help me fund my development projects while recommending great assets!
๐ Other Cool Unity Assets ๐
แ Peek - Editor Toolkit: assetstore.unity.com/packages/tools/utilities/peek-editor-toolkit-149410
แ Editor Console Pro: assetstore.unity.com/packages/tools/utilities/editor-console-pro-11889
แ Rainbow Folders 2: assetstore.unity.com/packages/tools/utilities/rainbow-folders-2-143526
โบโฑ๏ธ Timestamps โฑ๏ธ
0:00 Intro
0:25 Install Input System
0:42 Scene Setup
0:56 Drag and Drop Script
10:43 Move Object without Physics
11:51 Set Up Script
14:03 Set up Tag or Layer for Draggable Objects
15:37 Interfaces
19:51 2D Colliders
20:55 Outro
๐๐THANK YOU TO ALL MY PATRONS ๐๐
โฏโฏโฏ My Links โฎโฎโฎ
๐ Patreon ๐
patreon.com/samyg
๐ฌ Discord Server ๐ฌ
discord.gg/SwCKB3Q
๐ฆ Twitter ๐ฆ
twitter.com/samyam_utube
๐ Facebook ๐
facebook.com/samyam.youtube
๐ต Music ๐ต
Ambient Gold
streambeats.com
๐ Like and Subscribe! ๐
๐ฅ๏ธ Computer Setup ๐ฅ๏ธ
*As an Amazon Associate I earn from qualifying purchases.
amazon.com/shop/samyam
#madewithunity #gamedev #unity
This video shows an easy yet extendable way to implement drag and drop using the new input system in unity.
๐ฅ Get the Source Code ๐ฅ
patreon.com/posts/58031139
๐ค Support Me ๐ค
Patreon: patreon.com/samyg
Donate: ko-fi.com/samyam
โบ๐ Relevant Video Links ๐
แ Camera.ScreenPointToRay
docs.unity3d.com/ScriptReference/Camera.ScreenPointToRay.html
โบGet Object from Mouse Click and Call Functions through Interface 2D & 3D - Unity Tutorial
youtube.com/watch?v=JID7YaHAtKA
โบHow to use Unity's Input System
youtu.be/m5WsmlEOFiA
In this video we use Unity's new input system to implement dragging and dropping of both a 3d object and 2d object (2d collider). We use raycasts to get our object ScreenPointToRay, which takes into account the camera perspective easily, and then start a coroutine where we check each frame to see in what direction to move in. I'll show you how to implement this with physics to allow the object to stop when colliding with others, and also fall when released. I also show you how to use an interface to perform other actions once we've begun and ended dragging a gameobject.
Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we have recommended. While clicking these links won't cost you any money, they will help me fund my development projects while recommending great assets!
๐ Other Cool Unity Assets ๐
แ Peek - Editor Toolkit: assetstore.unity.com/packages/tools/utilities/peek-editor-toolkit-149410
แ Editor Console Pro: assetstore.unity.com/packages/tools/utilities/editor-console-pro-11889
แ Rainbow Folders 2: assetstore.unity.com/packages/tools/utilities/rainbow-folders-2-143526
โบโฑ๏ธ Timestamps โฑ๏ธ
0:00 Intro
0:25 Install Input System
0:42 Scene Setup
0:56 Drag and Drop Script
10:43 Move Object without Physics
11:51 Set Up Script
14:03 Set up Tag or Layer for Draggable Objects
15:37 Interfaces
19:51 2D Colliders
20:55 Outro
๐๐THANK YOU TO ALL MY PATRONS ๐๐
โฏโฏโฏ My Links โฎโฎโฎ
๐ Patreon ๐
patreon.com/samyg
๐ฌ Discord Server ๐ฌ
discord.gg/SwCKB3Q
๐ฆ Twitter ๐ฆ
twitter.com/samyam_utube
๐ Facebook ๐
facebook.com/samyam.youtube
๐ต Music ๐ต
Ambient Gold
streambeats.com
๐ Like and Subscribe! ๐
๐ฅ๏ธ Computer Setup ๐ฅ๏ธ
*As an Amazon Associate I earn from qualifying purchases.
amazon.com/shop/samyam
#madewithunity #gamedev #unity










