🎯Active Selections
Learn more about how you can customise behaviour of the selections.
Overview
ActiveSelections component manages current selections and highlights. It holds a list of all selected and highlighted units. This component may be accessed from UnitSelector.
Configuration
These configurations may be adjusted on the UnitSelector GUI itself.
Apply Max Active Selections - You can toggle this on/off to limit maximum number of selected units
Max Active Selections - Set maximal number of selected units
Debug
ActiveSelections component will show selected and highlighted unit list when the application is running for debug purposes.
Public Methods
Provides public interface for any modifications to these properties:
AddSelection, ReplaceSelection, Deselect and DeselectAll
Highlight and Unhighlight
Interfaces
For very fine grained custom behaviour of selections there are 2 interfaces available to implement and attach to the component. Both are optional, if one or both are set, they will be used during selection process.
IFilterSelection interface
Interface to help you filter out units during active selection. Examples:
Filtering Unit Types During Selection: When performing a drag selection that captures various unit types—such as structures and soldiers—you can implement a filter to exclude certain types. For instance, you may choose to retain only soldier units in the selection, thereby excluding structures.
Prioritizing Unit Affiliations: During selections that include both friendly and enemy units, you might want to prioritize by affiliation. This can be done by modifying the selection process to exclude enemy units, thus prioritizing friendly units within the selection results.
Use provided ManagedPlayerUnitsFilter component to achieve such prioritisation, owned units first.
ISortSelection Interface
Interface which can be used for custom sorting, before any selection limit is applied (max selections). This allows you to control which units to prioritise during selection, but not filter any of them out. Result of the selected units order will remain after selection.
Last updated