Target Indicators
Search Results for

    Show / Hide Table of Contents

    Visual indicator manager component

    The visual indicator manager component works with the TargetIndicatorManager and instantiates visual indicator prefabs and updates their state. There are several properties to configure for the component to work.

    An image of the Visual Indicator Manager component

    SerializedFields and properties

    The following sections describes each reference and settings of the component:

    Default visual indicator prefab

    This is a reference to the visual indicator prefab that will be instantiated in the UI by default when a target is added. You can assign this in the inspector or change it at runtime by assigning the DefaultVisualIndicatorPrefab.

    Target indicator manager

    This is a reference to the TargetIndicatorManager component in the scene that you want this visual indicator manager to interact with and respond to.

    Canvas

    This is the Canvas the visual indicators will be a part of. This reference is used in the calculation for the position to place visual indicators when the canvas scale changes. The canvas scale can change when using ScreenMatchMode.MatchWidthOrHeight on the CanvasScaler.

    Content

    This is the RectTransform in the Canvas you want to instantiate your visual indicators and parent them to.

    Add indicator mode

    This property controls whether visual indicators should automatically be created when the TargetIndicatorManager adds targets. If set to manual, it will only instantiate visual indicators when you call TargetIndicatorManager.AddTargetIndicator.

    API

    The visual indicator manager offers several APIs for you to have more control over what visual indicators get instantiated and when.

    Add target indicator

    If you want the visual indicator manager to track every target that is added to the target indicator manager you can add targets directly to the TargetIndicatorManager and leave the AddIndicatorMode to Auto. This way the visual indicator manager will automatically instantiate and update visual indicators.

    If you want the visual indicator manager to track specific targets from the target indicator manager, set the AddIndicatorMode to Manual and use one of the following APIs:

    1. AddTargetIndicator(Transform target)

      This API takes a transform of a target to track and adds it to the target indicator manager. It instantiates the default visual indicator prefab.

    2. AddTargetIndicator(Transform target, VisualIndicator indicatorPrefab)

      This API takes a transform of a target to track and adds it to the target indicator manager. It instantiates a new instance from the indicatorPrefab passed in as the second argument. Use this when you want a specific visual indicator for a target.

    Hide a visual Indicator

    VisualIndicator.HideVisualIndicator will hide the content and rotation content of a visual indicator without disabling the component at the root. Use this to temporarily hide a visual indicator if you don't want to destroy it.

    Show a visual Indicator

    VisualIndicator.ShowVisualIndicator This API shows the content and rotation content of a visual indicator that was previously hidden. Use this to show hidden indicators from HideVisualIndicator. Visual indicators are shown when first instantiated.

    RemoveTargetIndicator

    VisualIndicator.RemoveTargetIndicator removes a target from the target indicator manager. Use this when you are done tracking a target and want to destroy the visual indicator.

    Compass tape visual indicator manager

    The CompassTapeVisualIndicatorManager inhertis from VisualIndicatorManager and is specialized for handling target indicator managers with a CompassTape boundary type. It follows the same setup pattern. Use this class as an example to inherit the base visual indicator manager overriding the functionality with custom behavior.

    It requires a special implementation of CompassTapeVisualIndicator prefab for its DefaultVisualIndicatorPrefab. Refer to compass tape visual indicator for more information.

    An image of the Compass Tape Visual Indicator Manager component

    Full tape to visible tape ratio

    This is a unique property on the CompassTapeVisualIndicatorManager that is used for calculating the position on the compass tape's RectTransform to place the visual indicator. The value represents the ratio between the full tape and the visible tape. For example, if the full tape is twice the length of the visible tape this value would be 2.

    Refer to compass tape boundary type to learn more about how compass tapes work.

    In this article
    Back to top Generated by DocFX