Im trying to help a friend create a RTS game and i want to program it so i can create a box by clicking down on my mouse and dragging it and what ever is in the box gets selected this is what is have so far
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class RTStargeting : MonoBehaviour {
public Transform selectedTarget;
void Update(){
if (Input.GetMouseButtonUp(0)){ // when button clicked...
GUI.Box(new Rect());
}
private void SelectTarget(){
selectedTarget.renderer.material.color = Color.red;
}
private void DeselectTarget(){
if (selectedTarget){ // if any guy selected, deselect it
selectedTarget.renderer.material.color = Color.blue;
selectedTarget = null;
}
}
}
i have no idea what to put in the GUI box can anyone help me alter or complete this script so that when i click down and darg my mouse it creates a box and whatever character that are in it get selected