Answers for "how to detect a mouse click in unity"

C#
7

how to detect a mouse click in unity

using UnityEngine;
using System.Collections;

		if (Input.GetMouseButtonDown(0)) {
        	//Left Mouse Button
        } else if (Input.GetMouseButtonDown(1)) {
        	//Right Mouse Button
        } if (Input.GetMouseButtonDown(2)) {
        	//Middle Mouse Button
        }
Posted by: Guest on August-14-2020
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

Code answers related to "how to detect a mouse click in unity"

C# Answers by Framework

Browse Popular Code Answers by Language