Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

move object to mouse unity

//In 2d/UI you can move the object to your mouse position by writing this in a script and then adding it to the object you want to be at the mouse position also put it in the void update spot
transform.position = Input.mousePosition;

//or in 3d
transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition)
Comment

PREVIOUS NEXT
Code Example
Csharp :: learn c# 
Csharp :: get enum by index c# 
Csharp :: c# rename file add 
Csharp :: unity spawn button 
Csharp :: c# negative index 
Csharp :: c# list join 
Csharp :: c# sort array string by length 
Csharp :: stop flickering 
Csharp :: how to get the path of the current directory in c# 
Csharp :: c# @ before string 
Csharp :: c# get pixel color from image 
Csharp :: increase variable C# 
Csharp :: c# method summary new line 
Csharp :: unity cast float to int 
Csharp :: regular expression for website url validation in c# 
Csharp :: repeat 10 timesw c# 
Csharp :: c# winforms textbox to int 
Csharp :: invert string c# 
Csharp :: unity smooth rotation 2d 
Csharp :: .net mvc c# alert to client browswer window 
Csharp :: update models with ef core 
Csharp :: c# hello world 
Csharp :: unity hide mesh 
Csharp :: c# split on multiple characters 
Csharp :: unity on inspector change 
Csharp :: crop bitmap image c# 
Csharp :: unity topdown 
Csharp :: how to check a list is null or empty in c# 
Csharp :: dota2 
Csharp :: how to add a queue unity 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =