Logo
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.

Preview

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

NameTypeDescription
targetTransformTransformTracked target.
targetCameraCameraCamera used for screen projection.
hideWhenOnScreenboolHides the indicator when the target is visible.
rectBoundaryRectTransformUI boundary for the indicator.
borderOffsetfloatInset from the boundary.
distanceSourceTransformOrigin used for distance measurements.

Methods

NameParametersDescription
SetTarget()Transform newTargetChanges the tracked transform.
SetDistanceUnit()DistanceUnit unitChanges distance units.
SetRectBoundary()RectTransform boundaryChanges the UI boundary.
Disable()NoneDisables the indicator.

Example

OffScreenIndicatorExample.cs
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;
    }
}

On this page