Unit Selection
Guide on how to integrate Unit Selection with Unit System entities.
Last updated
Guide on how to integrate Unit Selection with Unit System entities.
Last updated
This page is for guiding you through the process of basic integration for package. Refer to the if you need more information.
For scene unit selection to work, you only need these two things:
Selection System prefab in scene and configure it (and it's visuals)
SelectableUnit
and additionally ManagedUnitObject
components to your units.
Now this will already work for selecting and highlighting units by the player. However since this is a separate package, we need to connect selection and interaction for the player.
If you are manually managing interactions and UI for selected units, you can skip this step.
However if you are using provided Player UI prefab, then EntitySelectionManager
is used to communicate selection changes to those scripts. For this we have provided 2 basic scripts that simplify the integration process.
Find and add Player Selection (Unit Selection) prefab to your scene. This includes:
PlayerUnitSelectionManager
script which replaces EntitySelectionManager
. This manages the communication between the EntitySelectionManager
interface and UnitSelector
to make sure the data is synced.
Additionally we have 2 scripts for filtering selection, both may be removed if undesired:
MultiSelectionFilter
script for basic Strategy filtering behaviour, this restricts multi selection to only owned units of the player; when dragging to select multiple units, only owned ones are selected. Does not impact single selection behaviour.
UnitStructureSelectionFilter
script, similar to the previous one it filters out units with buildable capabilities on multi-selection, but only when non-building is present. This means that drag to select can select buildings, as long as there is no other unit present in selection. Otherwise those units will be prioritised.