how to get cursor position unity code example
Example 1: unity get mouse position
Vector3 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Example 2: how to find the mouse position unity
Vector2 mousePosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Example 3: unity set cursor position
//C#
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);
int xPos = 30, yPos = 1000;
SetCursorPos(xPos,yPos);//Call this when you want to set the mouse position