how to detect mouse position in unity code example
Example 1: unity get mouse position
Vector3 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Example 2: 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
}