Hi
suppose there is a 3d cube in the center of the scene, all my request:
when click with left mouse over this cube, print “HIT …” is it easy to check that ?
Edit: i found this code:
var aim : GameObject;
function Update () {
if (Input.GetButtonDown ("Fire1")) {
// Construct a ray from the current mouse coordinates
var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray)) {
// print "Hit"
Debug.Log ("Hit");
}
}
}
but the problem unity print “Hit” when click ANY 3d model, i want print “Hit” only when click the cube model…