Answers for "how to know when click the mouse unity"

C#
9

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
13

how to find the mouse position unity

Vector2 mousePosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Posted by: Guest on March-12-2020

Code answers related to "how to know when click the mouse unity"

C# Answers by Framework

Browse Popular Code Answers by Language