Answers for "check for mouse click 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

unity mouse click

//Triggers when object is clicked
private void OnMouseDown()
{
  //Code to trigger
}
Posted by: Guest on January-18-2022

C# Answers by Framework

Browse Popular Code Answers by Language