- Home /
RTS. shift select.
hi, I am currently following this tutorial, but I have a question does anyone know how to intigrate a shift and click system to either select an extra object or to remove the object from a selection.
any help is welcome.
Could you be more specific on what exactly you are struggling with?
I have watched that video serie, I recommend watching the later videos as well before trying to replicate the project. As the tutorial maker is learning things himself as time progress and he changes things in later videos.
Basic steps: - Detect if shift is pressed - If unit is clicked, add to a list/array of selected units (I prefer Generic List http://wiki.unity3d.com/index.php?title=Which_$$anonymous$$ind_Of_Array_Or_Collection_Should_I_Use?#Generic_List ) - $$anonymous$$anage the list with foreach(Unit/Transform/OrAnytype unit in Units){
unit.giveOrder()`}`
Answer by Cynikal · Nov 03, 2014 at 11:06 PM
When I was making a similar system, the way I did it was...
When I clicked an object (that had a collider), I added it to a List.
Then, i'd instantiate a "selection" indicator (3d models that's a Circle) at the base of the object I clicked on.
If SHIFT is held down when left clicking, i'd List.Add(GameObject_I_Clicked_On)... If it was NOT held down, i'd clear the list, and just add the specific game object.
thank you, but I don't know how I would intigrate this with the selection box