Hey everyone,
Im making an RTS and im trying to begin by having a raycast able to be visible on click so that i can detect if a unit is being selected by the mouse (if there is an easier way let me know). Anyways, its not showing up, and I feel ive tried about everyting. Here is my code below:
if (Input.GetMouseButtonDown (0)) { //if left click...
startClick=Input.mousePosition; //give the position
//test code
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); //trying to single select
RaycastHit hit;
Debug.DrawRay (ray.origin, startClick * Mathf.Infinity, Color.red);
if (Input.GetMouseButtonDown (0)) {
if(Physics.Raycast(ray,out hit, Mathf.Infinity)){
//startClick=hit.point;
}
}