Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Selection Manager
  4. Selection Manager

Selection Manager

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:

  1. 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.
  2. 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.
  3. 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.
  4. Idle Units Selection: This feature allows the player to use a keyboard or a UI button to instantly select idle units from their faction.
    1. Enable Idle Units Selection: Enables/disables idle unit selection feature.
    2. Select Idle Units Key: The keyboard key that the player can use in order to select idle units.
    3. Select Idle Workers Only: When enabled, only idle builders and resource collectors will be selected.
  5. 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).
  6. Camera Follow: The main camera can follow selected entities.
    1. Enabled: When checked, the player will be able to follow selected entities with the main camera.
    2. Key: The key that the player needs to press in order to start following selected entities.
    3. 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.

Selection Box:

  1. 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.
  2. 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.
  3. 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.

Selection Options:

  1. Options: The options array allow to define selection options for resources, units and buildings. For each element in the array:
    1. Entity Type: Assign the entity type (resource, unit or building) for which the following options will apply regarding selection.
    2. Allow Multiple: Allow the player to select multiple instances of the above entity type at the same time?
    3. Exclusive: If enabled, then the above entity type can’t be selected with instances of different entity types.

Selection Flash:

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:

  1. Flash Time: For how long will the selection texture flash for?
  2. Flash Repeat Time: The flashing cycle of the selection texture.
  3. 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.
  4. Enemy Flash Color: If the object that holds the selection texture belongs to an enemy faction then it will have this color while flashing.

How can we help?