Class TargetIndicatorManager
Tracks targets and transforms their world space positions into screen space coordinates with options to clamp to the screen edges, absolute size, or a compass tape. Useful for displaying directions to targets and other positions in the environment.
Namespace: TargetIndicators
Assembly: TargetIndicators.dll
Syntax
public class TargetIndicatorManager : MonoBehaviour
Constructors
TargetIndicatorManager()
Declaration
public TargetIndicatorManager()
Properties
BottomPadding
The distance in pixels from the bottom edge of the screen for Padded boundary type.
Declaration
public float BottomPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
BoundaryShape
The shape of the boundary to clamp target indicators to.
Declaration
public BoundaryShape BoundaryShape { get; set; }
Property Value
| Type | Description |
|---|---|
| BoundaryShape |
BoundaryType
The type of boundary to clamp target indicators to.
Declaration
public BoundaryType BoundaryType { get; set; }
Property Value
| Type | Description |
|---|---|
| BoundaryType |
Camera
The scene camera that is used to calculate the screen pose of tracked targets.
Declaration
public Camera Camera { get; set; }
Property Value
| Type | Description |
|---|---|
| Camera |
Ellipse
The definition of the currently configured ellipse if BoundaryShape is set to Ellipse.
Declaration
public Ellipse Ellipse { get; }
Property Value
| Type | Description |
|---|---|
| Ellipse |
Height
The height in pixels centered at the screen center for Absolute boundary type.
Declaration
public float Height { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
LeftPadding
The distance in pixels from the left edge of the screen for Padded boundary type.
Declaration
public float LeftPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
MaxTargets
The max number of targets that can be tracked.
Declaration
public int MaxTargets { get; }
Property Value
| Type | Description |
|---|---|
| int |
Rectangle
The definition of the currently configured rectangle if BoundaryShape is set to Rectangle.
Declaration
public Rect Rectangle { get; }
Property Value
| Type | Description |
|---|---|
| Rect |
RightPadding
The distance in pixels from the right edge of the screen for Padded boundary type.
Declaration
public float RightPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
TopPadding
The distance in pixels from the top edge of the screen for Padded boundary type.
Declaration
public float TopPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
TrackedTargetsCount
The current number of targets being tracked.
Declaration
public int TrackedTargetsCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Width
The width in pixels centered at the screen center for Absolute boundary type.
Declaration
public float Width { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
GetChanges()
Manually processes world-to-screen transformations for all tracked targets and dispatches the corresponding added, updated, and removed events.
Declaration
public void GetChanges()
Remarks
Use this to synchronize indicator data and trigger events outside the standard
Update loop (for example, if this component is disabled, or you require mid-frame updates).
GetScreenPose(in Vector3, out bool)
Gets the screen pose of a world space position.
Declaration
public Pose GetScreenPose(in Vector3 worldSpacePosition, out bool isOutsideBoundary)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | worldSpacePosition | The world space position to convert to the screen pose. |
| bool | isOutsideBoundary |
|
Returns
| Type | Description |
|---|---|
| Pose | The screen space pose of |
IsOutsideBoundary(Vector3)
checks if the screen space position is outside the configured boundary.
Declaration
public bool IsOutsideBoundary(Vector3 screenPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | screenPoint | The screen point to test. Requires the point as a |
Returns
| Type | Description |
|---|---|
| bool |
|
RemoveAllTargets()
Removes all targets that are being tracked.
Declaration
public void RemoveAllTargets()
TryAddTarget(Transform, out TargetIndicator)
Attempts to add a new target to be tracked. This can only fail if the TrackedTargetsCount equals MaxTargets.
Declaration
public bool TryAddTarget(Transform target, out TargetIndicator targetIndicator)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | target | The transform of the target to track. |
| TargetIndicator | targetIndicator | The created TargetIndicator for the current frame of the target's position. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetTargetIndicator(TargetIndicatorId, out TargetIndicator)
Attempts to get the TargetIndicator for the corresponding TargetIndicatorId.
Declaration
public bool TryGetTargetIndicator(TargetIndicatorId targetIndicatorId, out TargetIndicator targetIndicator)
Parameters
| Type | Name | Description |
|---|---|---|
| TargetIndicatorId | targetIndicatorId | The ID of the target indicator. |
| TargetIndicator | targetIndicator | The TargetIndicator associated with
|
Returns
| Type | Description |
|---|---|
| bool |
|
TryRemoveTarget(TargetIndicatorId)
Attempts to remove a target indicator.
Declaration
public bool TryRemoveTarget(TargetIndicatorId targetIndicatorId)
Parameters
| Type | Name | Description |
|---|---|---|
| TargetIndicatorId | targetIndicatorId | The ID of the target indicator to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
Events
TargetIndicatorsAdded
Invoked when target indicators have been added.
Declaration
public event TargetIndicatorManager.TargetIndicatorsUpdatedDelegate TargetIndicatorsAdded
Event Type
| Type | Description |
|---|---|
| TargetIndicatorManager.TargetIndicatorsUpdatedDelegate |
TargetIndicatorsRemoved
Invoked when target indicators have been removed.
Declaration
public event TargetIndicatorManager.TargetIndicatorsRemovedDelegate TargetIndicatorsRemoved
Event Type
| Type | Description |
|---|---|
| TargetIndicatorManager.TargetIndicatorsRemovedDelegate |
TargetIndicatorsUpdated
Invoked when target indicators have been updated.
Declaration
public event TargetIndicatorManager.TargetIndicatorsUpdatedDelegate TargetIndicatorsUpdated
Event Type
| Type | Description |
|---|---|
| TargetIndicatorManager.TargetIndicatorsUpdatedDelegate |