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
@Will467, don't ask people to write scripts for you - that's a recipe for disaster here in UA, and you will only get downvotes. Try something like "could someone indicate a tutorial" or similar things - you may even end with a C# script written by some good soul, or at least with several useful links.
– aldonalettoOh ok im still new to unity and programming i didnt know ill alter my question.
– Robomasterok i altered my question, also i wanted to thank you for all your help it is really appreciated
– Robomaster