Unity3D – Mouse Buttons Codes


        // Detects clicks from the mouse and prints a message
	// depending on the click detected.

	function Update() {
		if(Input.GetMouseButtonDown(0))
			Debug.Log("Pressed left click.");

		if(Input.GetMouseButtonDown(1))
			Debug.Log("Pressed right click.");

		if(Input.GetMouseButtonDown(2))
			Debug.Log("Pressed middle click.");
	}