Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to detect mouse click in c#

[DllImport("user32.dll")]
static extern short GetAsyncKeyState(int VirtualKeyPressed);
 
public static bool GetLeftMousePressed()
    {
        if (GetAsyncKeyState(0x01) == 0)
            return false;
        else
            return true;
    }

// 0x01 stands for left Mouse click
// for different Virtual-Keys view list:
// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

Credit: Jason Wong on Stack Overflow
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity how to get y value 
Csharp :: c# list to string comma separated 
Csharp :: how to lerp in c# 
Csharp :: .net core temp directory 
Csharp :: use enter key unity 
Csharp :: textmeshpro text 
Csharp :: c# bytes to string 
Csharp :: c# new thread 
Csharp :: c# for each textbox lines 
Csharp :: how to get the current gameobject animator in unity 
Csharp :: c# how-to-download-image-from-url 
Csharp :: unity foreach dictionary 
Csharp :: unity enable gameobject 
Csharp :: random bool c# 
Csharp :: c# foreach enum 
Csharp :: make an enemy go towards player unity 
Csharp :: json stringify c# 
Csharp :: how to make among us clone in unity 
Csharp :: how to change the title of the console in c# 
Csharp :: how to create directory folder in c# 
Csharp :: how to get all files from folder and subfolders in c# 
Csharp :: unity remove gameobject 
Csharp :: how to detect when a player move in unity 
Csharp :: itextsharp landscape a4 
Csharp :: unity how to add force 
Csharp :: how to check if a number is even in c# 
Csharp :: random.range unity 
Csharp :: asp.net core redirecttoaction with parameters 
Csharp :: unity destroy object on collision 
Csharp :: C# metodas duomenu paemimui veiksmams ir grazinimui 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =