Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity get mouse position

Vector3 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Comment

how to find the mouse position unity

Vector2 mousePosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Comment

unity get mouse position

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        Vector3 mousePos = Input.mousePosition;            
    }
}
Comment

unity object to mouse position

//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

unity get mouse position

Vector2 screenPosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Vector2 worldPosition = Camera.main.ScreenToWorldPoint(screenPosition);
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to remove a component from an object in unity 
Csharp :: c# copy file to directory 
Csharp :: unity exit application 
Csharp :: check connection c# 
Csharp :: how to reload current scene unity 
Csharp :: unity mouse click m 
Csharp :: c# player movement 
Csharp :: c# random enum 
Csharp :: split with multiple delimiters c# 
Csharp :: unity access child 
Csharp :: unity 3d camera rotate up and down 
Csharp :: c# foreach enum 
Csharp :: c# get directory of executable 
Csharp :: C# string format sepperate every thousand 
Csharp :: core Request.CreateResponse 
Csharp :: unity C# catch index out or range exception 
Csharp :: xamarin button text lowercase 
Csharp :: c# read file by line 
Csharp :: c# randomize a list 
Csharp :: c# tostring mmm dd yyyy 
Csharp :: stop process c# 
Csharp :: add row to datagridview c# 
Csharp :: how to draw text in monogame 
Csharp :: c# boiler code shortcut 
Csharp :: set active text unity 
Csharp :: scaffold db ef core 
Csharp :: how to unset passwordchar in c# windows application 
Csharp :: unity detect if version is a build or in editor 
Csharp :: c# wirite to csv 
Csharp :: check if network is available c# 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =