The Selection Manager component handles simple & multiple selection.
When you’re creating a new map using the RTS Engine menu editor, this component is attached to an object called “SelectionManager”.
- Ray Layer Mask: Only the objects with layers that belong to this layer mask will be detected when the player is selecting something. You should have the ground terrain layers added to this layer mask and the layers that you’ve assigned to the different selection objects of unit, building and resource prefabs so they can be detected and selected by the selection manager.
- Free Selection Color: Selection color (specifically the color of the selection plane) that will be used for free units and buildings. Units and buildings that belong to a faction will have their faction color as their selection color.
- Double Click Selection Range: When the player double clicks on a friendly faction entity (building/unit) with the left mouse button, all faction entities of the player faction with the same type inside the range defined by this field will be selected.
- Idle Units Selection: This feature allows the player to use a keyboard or a UI button to instantly select idle units from their faction.
- Enable Idle Units Selection: Enables/disables idle unit selection feature.
- Select Idle Units Key: The keyboard key that the player can use in order to select idle units.
- Select Idle Workers Only: When enabled, only idle builders and resource collectors will be selected.
- Multiple Selection Key: While the key defined in this field is held down by the player, clicking on un-selected entities will add them to the selection list, clicking on already-selected entities will deselect them. In addition to that, clicking on an entity in the UI multiple selection panel while holding this key down will deselect that entity and clicking on an entity in the same panel without holding this key down will only keep that entity selected (rest will be deselected).
- Camera Follow: The main camera can follow selected entities.
- Enabled: When checked, the player will be able to follow selected entities with the main camera.
- Key: The key that the player needs to press in order to start following selected entities.
- Iterate: When enabled, the player will be able to camera follow the list of the selected entities by iterating through them using the above key. When disabled, the player will be only able to follow one selected entity.
- Canvas: The selection box requires to have its own separate UI canvas (mainly because the main canvas uses a Canvas Scaler component to scale UI elements and the selection box canvas doesn’t), drag and drop the selection box canvas into this field.
- Image: a UI Image, the only child of the selection box canvas. This is basically the box that will get drawn when the player clicks and drags the mouse around the screen to select multiple units.
- Minimum Size: When the player clicks and starts dragging the mouse, the formed box must have at least the size defined in this field in order to be visible.
- Options: The options array allow to define selection options for resources, units and buildings. For each element in the array:
- Entity Type: Assign the entity type (resource, unit or building) for which the following options will apply regarding selection.
- Allow Multiple: Allow the player to select multiple instances of the above entity type at the same time?
- Exclusive: If enabled, then the above entity type can’t be selected with instances of different entity types.
When commanding units to attack a unit/building or when asking a villager to collect from a resource, the selection texture of the unit/building to attack or the resource to collect from will flash. The following settings concern that selection texture flash:
- Flash Time: For how long will the selection texture flash for?
- Flash Repeat Time: The flashing cycle of the selection texture.
- Friendly Flash Color: If the object that holds the selection texture is friendly to the local player’s faction then it will have this color while flashing.
- Enemy Flash Color: If the object that holds the selection texture belongs to an enemy faction then it will have this color while flashing.