Highlighter Trigger

How to use

You can choose between two built-in triggering modes:

Object Enter Volume

The highlighter will be activated when an object belonging to the layer mask triggers the current object. The highlighter will be deactivated when the trigger ends.

Note: object must have a collider in order for the trigger to work.

Volume Layer Mask: Determines which layers should be able to trigger the highlighter's visibility.

Camera Raycast

The highlighter will be activated when you point directly at the object and will be deactivated when you stop pointing at it.

Note: object must have a collider in order for the trigger to work.

My Camera: The camera being used for raycasting.

Mas Distance From Camera: Maximum length of the ray being cast from the camera

Draw Debug Line: Check if you want to see how the ray cast from the camera looks.

Using custom events

You can create custom events using the highlighter trigger class functionality. There are two examples of how to do this and you can find them here. The best way to understand it is to look at these examples.

C# API

public bool IsCurrentlyTriggered - Whether the object is in a triggering state.

public event TriggeringEnd OnTriggeringEnded - Event, triggered when the state of the trigger changes to true.

public event TriggeringStart OnTriggeringStarted - Event, triggered when the state of the trigger changes to false.

public event Hit OnHitTrigger - Event for hit trigger.

public void ChangeTriggeringState(bool isTriggered) - Call this function on each update to update the state of the trigger. Updates the value of IsCurrentlyTriggered and calls the OnTriggeringEnded and OnTriggeringStarted events automatically when the state of the trigger changes.

public void TriggerHit() - All events subscribed to the OnHitTrigger event will be triggered.

Last updated