I am trying detect plane by ray but don’t know why i can’t
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, out hit, 20))
{
Debug.Log (1);
if (hit.collider.gameObject.name == "ciemnosc")
Debug.Log (2);
if (hit.collider.gameObject.GetComponent<detect>() == true)
Debug.Log (2);
}
I never turn on Debug.Log (2), but always turn on Debug.Log(1)