I've recently solved the single selection problem but now I want to do multiple selections. I know I need to find two points with the mouse position to draw a box but it just won't work for me.
void Update()
{
if (Input.GetMouseButtonDown(0))
{
bool dragging = true;
Debug.Log("Multiselect active");
MultiSelect(dragging);
}
}
private void MultiSelect(bool dragging)
{
mouseDownPoint = Input.mousePosition;
if (Input.GetMouseButtonUp(0) && dragging)
{
mouseUpPoint = Input.mousePosition;
}
Debug.Log("First pos: " + mouseDownPoint + " Second pos: " + mouseUpPoint);
dragging = false;
}
What is a better way to achieve what I'm trying? If someone can tell me a way that can also detect any units inside the area that'd be nice too.