}//Update End //selects Units (Enemies or allies) , selects or deselects multiple with shift key private void HandleLmbUp() { Ray ray = cam.ScreenPointToRay(Input.mousePosition); // this is our mouse position ray RaycastHit hit; //if we hit unit if (Physics.Raycast(ray, out hit) && hit.collider.gameObject.tag == "Unit") { UnitMovement hittedUnit = hit.collider.gameObject.GetComponent <UnitMovement>(); if (!Input.GetKey(KeyCode.LeftShift)) { if (selectionGroup.Count() > 0) { selectionGroup.DeselectAll(); } selectionGroup.Add(hittedUnit); } else { if (!selectionGroup.Contains(hittedUnit)) { selectionGroup.Add(hittedUnit); } else { selectionGroup.Remove(hittedUnit); hittedUnit.Deselect(); } } selectionGroup.SelectAll(); } else { if (!Input.GetKey(KeyCode.LeftShift)) { if (selectionGroup.Count() > 0) { selectionGroup.DeselectAll(); } } } }