UI Elements
Off Screen Indicator
Point toward targets outside the visible screen
Overview
Off Screen Indicator tracks a target and shows its direction near a UI boundary. It detects 2D and 3D targets automatically.
Usage
Create an indicator from the supplied setup.
Assign its target transform and the camera used to view the target.
Set a UI boundary and border offset.
Choose whether to hide the indicator when its target is on screen.
Tips
- Distance text supports metric or imperial units and a custom format.
- A separate distance source lets you measure from a player rather than the camera.
- Distance fading softens the indicator as you approach the target.
- Assign the camera explicitly in multi-camera scenes so indicators follow the intended view.
Public API
Use OffScreenIndicator in the Evo.UI namespace.
Fields
| Name | Type | Description |
|---|---|---|
targetTransform | Transform | Tracked target. |
targetCamera | Camera | Camera used for screen projection. |
hideWhenOnScreen | bool | Hides the indicator when the target is visible. |
rectBoundary | RectTransform | UI boundary for the indicator. |
borderOffset | float | Inset from the boundary. |
distanceSource | Transform | Origin used for distance measurements. |
Methods
| Name | Parameters | Description |
|---|---|---|
SetTarget() | Transform newTarget | Changes the tracked transform. |
SetDistanceUnit() | DistanceUnit unit | Changes distance units. |
SetRectBoundary() | RectTransform boundary | Changes the UI boundary. |
Disable() | None | Disables the indicator. |
Example
using UnityEngine;
using Evo.UI;
public class OffScreenIndicatorExample : MonoBehaviour
{
[SerializeField] private OffScreenIndicator target;
private void Start()
{
target.hideWhenOnScreen = true;
target.SetDistanceUnit(OffScreenIndicator.DistanceUnit.Metric);
target.borderOffset = 32f;
}
}