30 Seconds Tutorial | Dragging Game Objects With Mouse | Unity 2D

preview_player
Показать описание

In this 1 minute tutorial you'll learn how to drag with your mouse game objects in game, using a simple an efficient code.
Written in c#

Sub to the channel for more usable content that does not waist your precious time
Рекомендации по теме
Комментарии
Автор

No bitching around, simple and understandable tutorial. That's what i like.

FortenXd
Автор

this is a really good tutorial, i really like how it is just straight to the point and is very short but also very informative for a video that is only 44 seconds long.

Bobby-gllf
Автор

"fuck you watch this" lmao great excercise

Kaoji
Автор

that is by far my favorite ever tutorial intro

jacobmoran
Автор

Still works. Just change all vector2 to vector3. Thx for the video

dhdr
Автор

im suprised how this still works after 3 years, wonderful tutorial :]

ensick
Автор

I'm working on a game for my friend right now and wasn't looking forward to this part. It made me laugh so hard after it took less than 5 minutes because of this

twoidiotsonescreen
Автор

Muy buena explicación, directo al grano y sin rodeos. Algo rápida de pronto -para gente más leeenta como yo- pero poniendo pausa se sigue sin dificultad.

TaichiOsorno
Автор

i really like to learn by myself but srlsy it's so hard to do this by myself, thanks !

omar-
Автор

Guy, where are u? It's fuckinf Amazing

angrycatstudio
Автор

Whoaaa this guy is a magician OwO! Thank you

adev
Автор

how can I make it follow the mouse everytime, like without clicking it

maksimusi
Автор

Why can't I drag under the same circumstances ?

xukenzi
Автор

How to make sprites move smoothly
When you release the mouse, make them roll a little more (like curling or a puck on ice)?? Please 🙏

lora
Автор

Not work
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Draggable : MonoBehaviour
{
Vector2 difference = Vector2.zero;
// Start is called before the first frame update
// private void /// <summary>

private void OnMouseDown()
{
difference = - (Vector2)transform.position;
}



private void OnMouseDrag()
{
transform.position = - difference;
}

}

yessreendesign
Автор

thanks! How would i script it if i want the object to only be able to be dragged between two points?

tobiasnilssenopedal
Автор

Great tutorial, just make notice, like the title says, this is just for mouse use. Not relevant to touch.

teharchon
Автор

please remind work in Camera projection for orthographic projection only

chaiontse
Автор

i know this vi isnt the newest but i sti ask im getting two errors the first one is: Vector2 which is not valid in the given context.
and the second one: Vector2 does not contain a definition for transfor.position
any advice please?

apats
Автор

Any help?

Assets\StickManDragger.cs(11, 22): error CS0030: Cannot convert type 'method' to 'Vector2'

Atskas