void Update()
{
Ray ray = uiCamera.ScreenPointToRay (Input.mousePosition);
Debug.DrawLine (uiCamera.ScreenPointToRay(Input.mousePosition).GetPoint(0f), uiCamera.ScreenPointToRay(Input.mousePosition).GetPoint(0f)+Vector3.forward*100f,Color.red, 1000f);
RaycastHit[] hit;
hit = Physics.RaycastAll (ray, 400f);
for (int i = 0; i < hit.Length; i++)
{
Debug.Log ("Hit " + hit[i].transform.gameObject.name);
if (hit [i].transform.gameObject.layer == 8)
{
selectedModel = hit[i].transform.gameObject.name;
InstantiateSelectedModelInUI (selectedModel);
}
}
}