hello,
i tried to convert some js in c# for my RTS and im chocking atm at this part
//Single Unit Selection
if (Input.GetMouseButtonDown(0))
{
selectionEnded = false;
//Cast Ray to hit Ground
Ray ray_ground = camera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit_ground;
int ground_Layermask = 1 << 8; // not sure what this << means couldnt google it
// givs the error: best match Raycast(UnityEngine.Ray,out UnityEngine.RaycastHit, float, int)
if (Physics.Raycast(ray_ground, hit_ground, Mathf.Infinity, ground_Layermask))
{
selection_Start = hit_ground.point; //Store initial hit
}
//Cast Ray to Select Unit
Ray ray = camera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
int unit_Layermask = 1 << 10;
//smae story
if (Physics.Raycast(ray, hit, Mathf.Infinity, unit_Layermask))
{
//Store Unit in Selectables
clearSelectables();
hit.collider.GetComponent<Selectable>().selected = true;
// selectables is a List<GameObject> still its gives a error that its want a GameObject
selectables.Add(hit.collider);
}
//Didn't click on Ground
else
{
clearSelectables();
}
//Store the Mouse position
start_Mouse = Input.mousePosition;
}