Is there a way to manipulate the mouse position without using System.Windows.Forms.Cursor? Something like interop maybe?
Reason for this is that we are using a specialized .NET subset which can't include System.Windows.Forms.
SetCursorPosition(Int32, Int32) Method is used to set the position of cursor. Basically, it specifies where the next write operation will begin in the console window.
In Unity, getting the mouse position on the screen is fairly straightforward. It's a property of the Input class so, to access it from a script, all you need to do is use Input. mousePosition, which returns the position of the mouse, in pixels, from the bottom left of the screen. Simple.
In Mouse Properties, on the Pointer Options tab, at the bottom, select Show location of pointer when I press the CTRL key, and then select OK. To see it in action, press CTRL.
oops my bad, read question too fast, heres the correct PInvoke call
[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);
Source: http://www.pinvoke.net/default.aspx/user32.setcursorpos
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With