π Selectable Unit
Everything about SelectableUnit component.
Last updated
Everything about SelectableUnit component.
Last updated
SelectableUnit component implements state management for the unit selection along with updating the Selection Indicator reference (if one is set). This component provides out of the box functionality for unit selection by implementing ISelectable interface. This is default single selection behaviour, for selecting a unit as group of units see the extension component Selectable Group Unit.
There are only few things this component does, so options to customise also reflect this.
Selection Indicator reference is used for updating visual state of the unit.
More details selection indicators can be found here Selection Indicator.
Indicator Priority defines which of the visual states is shown when both are active (selected and highlighted). Simple example of this scenario would be when unit is already selected and mouse hovers over it. Should it keep selected state showing or override it with highlighted state.
OnSelectionStateChange is Unity Event invoked when any of the selection states on unit change. You can use this to update custom any data needed managed by your components or updating custom selection indicator that does not use ASelectionIndicator abstraction
Communication between units and selection system is done with ISelectable interface. To replace the use of SelectableUnit component, create or use existing mono behaviour to implement your own management of the unit state. Example: