Answers for "unity check if mouse left click"

C#
2

unity check if mouse left click

void Update()
{
    if (Input.GetMouseButtonDown(0))
        Debug.Log("Pressed primary button.");

    if (Input.GetMouseButtonDown(1))
        Debug.Log("Pressed secondary button.");

    if (Input.GetMouseButtonDown(2))
        Debug.Log("Pressed middle click.");
}
Posted by: Guest on September-12-2021
0

How to detect single mouse click in Unity

void OnMouseUp() {   /*Do whatever here as per your need*/ }  As well as you can use    void OnMouseDown() {   /*Do your stuff here*/ }
Posted by: Guest on May-27-2021

C# Answers by Framework

Browse Popular Code Answers by Language