I want to make an object clickable, what code do i use ? all the references i found where in java =(
Try using this in an update function. Just change the tag to whatever the tag of the object you want to click will be.
if (Input.GetMouseButtonDown(0))
{
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, hit, 100.0))
{
myTarget = hit.collider.gameObject;
if(myTarget.tag=="tagOfTheObject")
{
//DO STUFF
}
}
}