C# SetCursorPosition not working in a game

I trying to change the gun target using this code

Cursor.Position = new Point(20,20);

Its working on my desktop but cursor is does not change on a game.
How can i change my cursor position in a 3d game?

Game Window

Edit:
As a result of research, SetCurusorPos is not working owing to anti-cheat system.
Valorant vanguard is not allowed to external mouse moves

>Solution :

Valorant, the game you’re trying to change the cursor with, is ran as an elevated process with anti cheat, it probably hooked the mouse and prevented outside modification. Try running Visual Studio as administrator and debug your app.

Leave a Reply