Skip to main content

Introduction

This component allows you to target one or more other GameObjets with a LockOnTarget component attached.

"Targeting System"

Fields#

NameDescription
Is 2D ModeActivate 2D lock-on mode
Auto Lock OnAutomatically lock-on to target(s) in range
With ButtonLock on to targets in range with button press
Lock On ButtonButton to use for locking on
With KeyLock on to targets in range with key press
Lock On KeyKey to use for locking on
Layer MaskLayers to include when checking for targets
Tag ModeMethod used for selecting based on tags
Tag FilterList of tags used for filtering targets
Lock RadiusRadius to check for targets
Minimum DistanceMinimum allowed distance to target
Remove With ButtonLock on to targets in range with button press
Remove Lock On ButtonButton to use for locking on
Remove With KeyLock on to targets in range with key press
Remove Lock On KeyKey to use for locking on
Require Line Of SightRequire unobstructed view of target
Obstruction LayerLayers to include when checking for obstructions
Los OffsetOffset from transform position when looking for target
Available Target PrefabPrefab to instance on targets that can be locked on but are not
Locked Target PrefabPrefab to instance on targets that are actively locked on
On Available Targets ChangedEvent raised when available target list changes
On Locked Targets ChangedEvent raised when locked on target list changes

Properties#

NameDescription
allTargetsList of all available targets
bestLockOptionGets the closets available lock on target
lockedTargetsList of all locked on targets
optionalTargetsList on all non-locked targets
showIndicatorsShow lock-on indicators

Methods#

NameDescription
GetClosestTargetGets the closest target
GetClosestTargetsGets a list of closest targets
GetLockedTargetsGets a list of locked targets
HasLineOfSightChecks if there is a line of sight from system to target
RemoveAllLockOnsRemoves all active lock-ons
ToggleLockToggles the lock-on mode of a target