using UnityEngine;
using System.Collections;
public class Mouse : MonoBehaviour
{
Ray ray;
RaycastHit hit;
void Update()
{
if (Input.GetMouseButton(0))
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit))
Debug.Log(hit.collider.gameObject.name);
}
}
}