Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to set a objects position to the 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)
Source by vionixstudio.com #
 
PREVIOUS NEXT
Tagged: #set #objects #position #mouse #unity
ADD COMMENT
Topic
Name
6+9 =