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”.
General Selection Settings:
- Raycast Layer Mask: What layers does the selection manager consider? It is recommended to have the same layer mask as in the demo scene.
- Unit Selection Texture: Texture that will be used in the unit’s texture plane material.
- Building Selection Texture: Texture that will be used in the building’s texture plane material.
- Resource Selection Texture: Texture that will be used in this resource’s texture plane material.
- Multiple Selection Key: Holding this key down and selecting single units will add them to the selected units list.
- Double Click Select Size: When double clicking with the left mouse button on a friendly unit, all units with the same type inside the range that is defined by this field will be selected.
- Select Idle Workers Only: A UI button can trigger the selection of the player’s faction idle units by triggering the “SelectIdleUnits” method of the SelectionManager class when clicked. This field defines whether that method should select idle workers only (units that have the Builder and/or Resource Collector components) or not.
Selection Box Settings:
- Selection Box: a UI Image, child object of the Selection Box Canvas (not the Main Canvas). This represents the square that gets drawn when the player clicks and drags the mouse in the screen to select multiple units.
- Canvas: Drag and drop the main canvas to this field.
- Min Box Size: The minimum selection box size to show it on screen.
Selection Flash Settings:
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 flash:
- Flash Time: For how long will the selection texture flash for?
- 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.
- Flash Repeat Time: The flashing cycle of the selection texture.