Scripting Support (C#)

advanced scripting

Highlight Plus · Scripting Support (C#)

The HighlightPlus namespace provides a comprehensive highlighting system for 3D objects in Unity. Add using HighlightPlus; at the top of your scripts.

HighlightEffect

MonoBehaviour — The main component that controls all highlight effects on a GameObject. Attach to any renderer or parent object.

Highlight Control

bool highlighted get/set

Enables or disables the highlight effect. Setting this triggers fade animations if fadeInDuration/fadeOutDuration are configured.

bool isSelected get/set

Gets or sets the selection state of this object.

bool ignore

When true, the object will not be highlighted by automatic systems (HighlightManager/HighlightTrigger).

float fadeInDuration

Duration in seconds for the highlight fade-in animation.

float fadeOutDuration

Duration in seconds for the highlight fade-out animation.

FadingState fading

Current fading state of the effect (NoFading, FadingIn, FadingOut).

void SetHighlighted(bool state)

Programmatically sets the highlight state. Equivalent to setting the highlighted property.

static HighlightEffect lastHighlighted

Reference to the last highlighted object in the scene.

static HighlightEffect lastSelected

Reference to the last selected object in the scene.

static effects List<HighlightEffect>

List of all active HighlightEffect instances in the scene.

static bool useUnscaledTime

When true, all effects use Time.unscaledTime instead of Time.time, allowing effects to work when the game is paused.

Target & Geometry

TargetOptions effectGroup

Determines which renderers are included. Options: Children, OnlyThisObject, RootToChildren, LayerInScene, LayerInChildren, Scripting.

Transform effectTarget

Optional explicit target transform for the effect.

LayerMask effectGroupLayer

Layer mask filter applied when effectGroup uses layer-based targeting.

string effectNameFilter

Optional name filter for included renderers. Supports plain text or regex when effectNameUseRegEx is true.

bool effectNameUseRegEx

When true, effectNameFilter is interpreted as a regular expression.

bool excludeObjectsWithHighlightEffect

When true, child objects that already have their own HighlightEffect component are excluded from this group.

bool combineMeshes

Combines all meshes in the group for a unified outline/glow effect without internal edges.

Transform target get/set

Gets or sets the target transform at runtime.

int includedObjectsCount read-only

Returns the number of renderers currently included in this effect.

void SetTarget(Transform transform)

Sets a new target transform and re-initializes the effect on the new hierarchy.

void SetTargets(Transform transform, Renderer[] renderers)

Sets a target with explicit renderers instead of auto-detecting them from the hierarchy.

bool Includes(Transform transform)

Returns true if the given transform is part of this effect's renderer group.

Rendering Options

LayerMask camerasLayerMask

Restricts which cameras render this effect.

float alphaCutOff

Alpha cutoff threshold for transparent objects. Pixels below this threshold are excluded from the effect.

bool cullBackFaces

Enables back-face culling for the highlight effect rendering.

bool ignoreObjectVisibility

When true, the effect renders even if the object's renderer is disabled.

bool GPUInstancing

Enables GPU instancing for improved performance when multiple objects share the same effect.

bool constantWidth

When true, outline and glow width remain constant regardless of camera distance.

float padding

Additional padding around the object bounds for the effect.

int subMeshMask

Bitmask controlling which sub-meshes are included. -1 includes all sub-meshes.

bool depthClip

Enables depth clipping to prevent effects from rendering through geometry.

bool optimizeSkinnedMesh

Optimizes skinned mesh rendering by caching mesh data.

bool cameraDistanceFade

Enables distance-based fading of the highlight effect.

float cameraDistanceFadeNear

Distance at which the effect starts fading.

float cameraDistanceFadeFar

Distance at which the effect is fully faded out.

NormalsOption normalsOption

Controls how mesh normals are used for the effect (Smooth, PreserveOriginal, Reorient, Planar).

float minimumWidth

Minimum width for outlines and glows to prevent them from disappearing at large distances.

Outline

float outline

Outline intensity. 0 disables the outline, 1 is fully visible.

Color (HDR) — default: black outlineColor

Outline color. Supports HDR values for bloom-compatible outlines.

float outlineWidth

Width of the outline in world units (or screen units if constantWidth is true).

QualityLevel outlineQuality

Quality of the outline rendering (Fastest, High, Highest, Medium).

OutlineEdgeMode outlineEdgeMode

Controls whether the outline appears on the exterior only or also on interior edges.

float outlineEdgeThreshold

Sensitivity for interior edge detection when outlineEdgeMode includes interior edges.

Visibility outlineVisibility

Controls whether the outline is visible normally, always on top, or only when occluded.

bool outlineIndependent

When true, the outline renders independently from the glow, preventing overlap artifacts.

ColorStyle outlineColorStyle

Color mode for the outline (SingleColor or Gradient).

Gradient (HDR) outlineGradient

Gradient used when outlineColorStyle is set to Gradient.

bool outlineGradientInLocalSpace

When true, the gradient is applied in local object space instead of world space.

int outlineBlurPasses

Number of blur passes for soft outline rendering.

float outlineSharpness

Controls the sharpness of the outline edge.

int outlineDownsampling

Downsampling factor for outline rendering. Higher values improve performance at the cost of precision.

ContourStyle outlineContourStyle

Controls the contour rendering style (AroundVisibleParts, AroundObjectShape).

Stylized Outline

bool outlineStylized

Enables the stylized/patterned outline mode.

Texture2D outlinePattern

Pattern texture applied to the stylized outline.

float outlinePatternScale

Scale of the pattern texture.

float outlinePatternThreshold

Threshold for pattern visibility.

float outlinePatternDistortionAmount

Amount of noise distortion applied to the pattern.

Texture2D outlinePatternDistortionTexture

Distortion noise texture for the stylized pattern.

float outlinePatternStopMotionScale

Controls the stop-motion animation scale of the pattern.

Dashed Outline

bool outlineDashed

Enables dashed outline rendering.

float outlineDashWidth

Width of the visible dash segments.

float outlineDashGap

Size of the gap between dash segments.

float outlineDashSpeed

Animation speed of the dashed pattern.

Outer Glow

float glow

Outer glow intensity. 0 disables the glow.

Color (HDR) — default: (0.64, 1, 0, 1) glowHQColor

Glow color when using High Quality mode. Supports HDR for bloom-compatible glows.

float glowWidth

Width of the outer glow effect.

QualityLevel glowQuality

Quality of the glow rendering (Fastest, High, Highest, Medium).

BlurMethod glowBlurMethod

Blur algorithm used for the glow (Gaussian, Kawase).

bool glowHighPrecision

Uses higher precision render textures for the glow effect.

int glowDownsampling

Downsampling factor for glow rendering. Higher values improve performance.

float glowAnimationSpeed

Animation speed of the glow pulsing effect.

Visibility glowVisibility

Controls whether the glow is visible normally, always on top, or only when occluded.

GlowPassData[] glowPasses

Array of glow pass configurations controlling multi-layer glow effects with individual offset, width, and color per pass.

GlowBlendMode glowBlendMode

Blend mode for the glow (Additive, Cutout).

bool glowBlendPasses

When true, multiple glow passes blend together for a smoother result.

float glowDithering

Amount of dithering applied to reduce banding artifacts in the glow.

void SetGlowColor(Color color)

Sets the glow color for all glow passes at once.

Inner Glow

float innerGlow

Inner glow intensity. 0 disables the inner glow.

Color (HDR) — default: white innerGlowColor

Color of the inner glow effect.

float innerGlowWidth

Width of the inner glow from the object edges inward.

float innerGlowPower

Power/falloff curve of the inner glow effect.

InnerGlowBlendMode innerGlowBlendMode

Blend mode for the inner glow (Additive, AlphaBlend).

Visibility innerGlowVisibility

Controls visibility of the inner glow (Normal, AlwaysOnTop, OnlyWhenOccluded).

Overlay

float overlay

Overlay intensity. 0 disables the overlay effect.

Color (HDR) — default: yellow overlayColor

Color of the overlay effect.

OverlayMode overlayMode

Controls when the overlay is visible (WhenHighlighted, Always).

float overlayAnimationSpeed

Speed of the overlay pulsing animation.

float overlayMinIntensity

Minimum intensity during overlay animation cycles.

float overlayBlending

Controls the blending strength of the overlay with the underlying material.

Texture2D overlayTexture

Optional texture applied as the overlay pattern.

TextureUVSpace overlayTextureUVSpace

UV coordinate space for the overlay texture (ObjectSpace, ScreenSpace, WorldSpace).

float overlayTextureScale

Scale of the overlay texture.

Vector2 overlayTextureScrolling

Scrolling speed of the overlay texture in X and Y directions.

Visibility overlayVisibility

Controls visibility of the overlay (Normal, AlwaysOnTop, OnlyWhenOccluded).

OverlayPattern overlayPattern

Built-in procedural overlay pattern (None, Dots, Lines, Grid, etc.).

float overlayPatternScale

Scale of the procedural overlay pattern.

float overlayPatternSize

Size of pattern elements.

float overlayPatternSoftness

Edge softness of the pattern elements.

float overlayPatternRotation

Rotation of the overlay pattern in degrees.

Vector2 overlayPatternScrolling

Scrolling speed of the overlay pattern.

See-Through

SeeThroughMode seeThrough

See-through rendering mode (Never, WhenHighlighted, AlwaysWhenOccluded, etc.).

LayerMask seeThroughOccluderMask

Layers that act as occluders for the see-through effect.

bool seeThroughOccluderMaskAccurate

Uses per-pixel accurate occlusion testing instead of bounds-based.

float seeThroughOccluderThreshold

Threshold for determining when an object is considered occluded.

float seeThroughOccluderCheckInterval

Interval in seconds between occlusion checks. Lower values are more responsive but costlier.

bool seeThroughOccluderCheckIndividualObjects

When true, checks occlusion for each renderer individually rather than the group bounds.

float seeThroughIntensity

Intensity of the see-through silhouette.

Color (HDR) — default: red seeThroughTintColor

Tint color of the see-through silhouette.

float seeThroughTintAlpha

Alpha transparency of the see-through tint.

float seeThroughNoise

Amount of noise/scanline effect applied to the see-through silhouette.

float seeThroughBorder

Intensity of the see-through silhouette border/outline.

Color seeThroughBorderColor

Color of the see-through border.

float seeThroughBorderWidth

Width of the see-through border.

bool seeThroughBorderOnly

When true, only the border is shown without the tinted fill.

float seeThroughDepthOffset

Depth offset for the see-through effect to fine-tune occlusion behavior.

float seeThroughMaxDepth

Maximum depth at which the see-through effect is visible. 0 means unlimited.

float seeThroughFadeRange

Range over which the see-through effect fades out near the max depth.

bool seeThroughOrdered

Enables ordered rendering for correct see-through with multiple overlapping objects.

Texture2D seeThroughTexture

Optional texture applied to the see-through silhouette.

TextureUVSpace seeThroughTextureUVSpace

UV coordinate space for the see-through texture.

float seeThroughTextureScale

Scale of the see-through texture.

Target FX

bool targetFX

Enables the animated target indicator effect (ground marker below the object).

TargetFXStyle targetFXStyle

Visual style of the target FX (Texture, Frame).

Texture2D targetFXTexture

Texture used for the target indicator when style is Texture.

Color (HDR) — default: white targetFXColor

Color tint of the target indicator.

Transform targetFXCenter

Optional custom center point for the target indicator.

float targetFXRotationSpeed

Rotation speed of the target indicator in degrees per second.

float targetFXRotationAngle

Fixed rotation angle for the target indicator. 0 uses rotation speed animation.

float targetFXInitialScale

Starting scale of the target indicator animation (scales down to targetFXEndScale).

float targetFXEndScale

Final scale of the target indicator after the transition animation completes.

bool targetFXScaleToRenderBounds

When true, the target indicator scales relative to the object's render bounds.

bool targetFXSquare

Forces the target indicator to maintain a square aspect ratio.

bool targetFXAlignToGround

Projects the target indicator onto the ground surface below the object.

float targetFXGroundMaxDistance

Maximum raycast distance for ground alignment.

LayerMask targetFXGroundLayerMask

Layer mask for ground detection raycast.

Vector3 targetFXOffset

Position offset for the target indicator.

float targetFXTransitionDuration

Duration of the scale-in transition animation.

float targetFXStayDuration

How long the target indicator remains visible after the transition.

Visibility targetFXVisibility

Controls whether the target FX renders on top of other geometry.

float targetFXFrameWidth

Line width when using Frame style.

float targetFXCornerLength

Corner bracket length when using Frame style.

bool targetFxCenterOnHitPosition

Centers the target FX on the hit/click position instead of the object center.

bool targetFxAlignToNormal

Aligns the target FX to the surface normal at the hit point.

void TargetFX()

Triggers the target FX animation on demand.

Icon FX

bool iconFX

Enables a 3D icon/mesh indicator above the object.

IconAssetType iconFXAssetType

Type of asset for the icon (Mesh or Prefab).

GameObject iconFXPrefab

Prefab used as the icon when asset type is Prefab.

Mesh iconFXMesh

Mesh used as the icon when asset type is Mesh.

Color (HDR) — default: white iconFXLightColor

Light/highlight color of the icon mesh.

Color (HDR) — default: gray iconFXDarkColor

Dark/shadow color of the icon mesh.

Transform iconFXCenter

Optional custom center transform for the icon positioning.

float iconFXRotationSpeed

Rotation speed of the icon in degrees per second.

IconAnimationOption iconFXAnimationOption

Animation type for the icon (None, Bounce, Pulse).

float iconFXAnimationAmount

Amplitude of the icon animation.

float iconFXAnimationSpeed

Speed of the icon animation.

float iconFXScale

Scale multiplier for the icon.

Vector3 iconFXOffset

Position offset for the icon relative to the object center.

float iconFXTransitionDuration

Duration of the icon appear/disappear transition.

float iconFXStayDuration

How long the icon stays visible after the transition.

void IconFX()

Triggers the icon FX animation on demand.

Hit FX

float hitFxInitialIntensity

Default initial intensity for hit effects.

HitFxMode hitFxMode

Visual mode for hit effects (Overlay, InnerGlow, LocalHit).

HitFXTriggerMode hitFXTriggerMode

How hit effects are triggered (Scripting, Collider).

float hitFxFadeOutDuration

Duration of the hit effect fade-out in seconds.

Color (HDR) — default: white hitFxColor

Color of the hit flash effect.

float hitFxRadius

Radius for localized hit effects.

void HitFX()

Triggers a hit effect using the default field values (hitFxColor, hitFxFadeOutDuration, hitFxInitialIntensity).

void HitFX(Vector3 position)

Triggers a localized hit effect at the specified world position.

void HitFX(Color color, float fadeOutDuration, float initialIntensity = 1f)

Triggers a hit effect with custom color, fade-out duration, and initial intensity.

void HitFX(Color color, float fadeOutDuration, float initialIntensity, Vector3 position, float radius)

Triggers a localized hit effect with full control over color, fade, intensity, position, and radius.

void SetHitPosition(Transform target, Vector3 localPosition, Vector3 offsetWS, Vector3 normalWS)

Sets the hit position manually. Updates the label position if labelFollowCursor is enabled.

Focus

float focus

Intensity of the focus effect (0–1). Dims the background while keeping highlighted objects visible. A value of 0 disables the effect.

Color focusColor

Color and transparency of the focus dim overlay. Default: semi-transparent black (0, 0, 0, 0.94).

float focusBlur

Background blur intensity for the focus effect (0–1).

int focusBlurDownsampling

Downsampling factor for the focus blur (1–8). Higher values improve performance at the cost of quality. Default: 2.

float focusDesaturation

Desaturation intensity for the focus background (0–1). A value of 1 makes the background fully grayscale.

Labels

bool labelEnabled

Enables a floating text label above the highlighted object.

string labelText

Text content displayed in the label.

float labelTextSize

Font size of the label text.

Color (HDR) — default: white labelColor

Color of the label text.

GameObject labelPrefab

Custom prefab for the label UI. Must contain a TextMeshProUGUI component.

LabelMode labelMode

Controls when the label is visible (WhenHighlighted, Always, WhenSelected).

float labelVerticalOffset

Vertical offset of the label above the object.

Vector2 labelViewportOffset

Screen-space offset for the label position.

float labelLineLength

Maximum line width in pixels before text wrapping.

bool labelFollowCursor

When true, the label follows the mouse cursor position instead of staying fixed above the object.

LabelAlignment labelAlignment

Text alignment of the label (Auto, Left, Center, Right).

float labelMaxDistance

Maximum distance from the camera at which the label is visible.

float labelFadeStartDistance

Distance at which the label starts fading out.

bool labelScaleByDistance

When true, the label scales based on camera distance.

float labelScaleMin

Minimum scale of the label when scaling by distance.

float labelScaleMax

Maximum scale of the label when scaling by distance.

void RefreshLabel()

Destroys and recreates the label with current settings.

Events

event OnObjectHighlightStart(GameObject obj)

Fired when the object begins highlighting. Return false to cancel the highlight.

event OnObjectHighlightEnd(GameObject obj)

Fired when the highlight is removed. Return false to prevent un-highlighting.

event OnObjectHighlightStateChange(GameObject obj, bool state)

Fired on any highlight state change. Provides both the object and new state.

event OnObjectSelected(GameObject obj)

Fired when the object is selected. Return false to cancel the selection.

event OnObjectUnSelected(GameObject obj)

Fired when the object is deselected. Return false to cancel the deselection.

event OnRendererHighlightStart(Renderer renderer)

Fired per renderer when highlighting starts. Return false to exclude a specific renderer from highlighting.

event OnTargetAnimates(ref Vector3 center, ref Quaternion rotation, ref Vector3 scale, float t)

Fired during Target FX animation, allowing custom control over the indicator's position, rotation, and scale. The parameter t is the animation progress (0-1).

event OnIconAnimates(ref Vector3 center, ref Quaternion rotation, ref Vector3 scale, float t)

Fired during Icon FX animation with the same parameters as OnTargetAnimates.

Profile Management

HighlightProfile profile

The profile asset assigned to this effect. When assigned with profileSync enabled, all changes to the profile are automatically applied.

bool profileSync

When true, the effect stays synchronized with the assigned profile.

void ProfileLoad(HighlightProfile profile)

Loads all settings from a profile into this effect.

void ProfileReload()

Reloads settings from the currently assigned profile.

void ProfileSaveChanges(HighlightProfile profile)

Saves the current effect settings to the specified profile asset.

void ProfileSaveChanges()

Saves the current effect settings to the currently assigned profile.

void RestorePreviousHighlightEffectSettings()

Restores the effect settings to the state before the last profile was loaded.

Utility Methods

void Refresh(bool discardCachedMeshes = false)

Re-initializes the effect. Pass true to discard cached mesh data (useful after mesh changes).

void UpdateMaterialProperties(bool disabling = false)

Updates all internal material properties. Call this after changing effect settings via script.

void ResetHighlightStartTime()

Resets the animation start time, causing time-based animations to restart from the beginning.

static ClearMeshCache void ()

Clears the global mesh cache used by all effects. Call when loading a new scene or after significant mesh changes.

HighlightProfile

ScriptableObject — Stores highlight effect settings as a reusable asset. Create via Assets > Create > Highlight Plus > Highlight Profile. Contains all the same visual settings as HighlightEffect (outline, glow, overlay, see-through, target FX, icon FX, hit FX, labels) and can be loaded/saved at runtime.

HighlightManager

MonoBehaviour — Automatic highlight management component. Add to a scene to enable pointer-based highlighting and selection for all objects with HighlightEffect components. Uses raycasting to detect objects under the cursor.

Properties

static instance HighlightManager — read-only

Singleton reference to the HighlightManager in the scene.

static selectedObjects List<HighlightEffect> — read-only

List of all currently selected objects managed by HighlightManager.

bool highlightOnHover get/set

When true, objects are highlighted when the pointer hovers over them.

LayerMask layerMask

Layer mask for raycast detection. Only objects on these layers can be highlighted.

Camera raycastCamera

Camera used for raycasting. Defaults to Camera.main if not set.

RayCastSource raycastSource

Input source for raycasting (MousePosition, ScreenCenter).

LayerMask blockingLayerMask

Objects on these layers block the raycast from reaching highlight targets.

float minDistance

Minimum raycast distance for detecting objects.

float maxDistance

Maximum raycast distance. 0 means unlimited.

bool selectOnClick

Enables object selection on click/tap.

HighlightProfile selectedProfile

Profile applied to selected objects (replaces their highlight settings while selected).

HighlightProfile selectedAndHighlightedProfile

Profile applied when an object is both selected and highlighted simultaneously.

bool singleSelection

When true, only one object can be selected at a time.

bool toggle

When true, clicking a selected object deselects it.

bool keepSelection

When true, selected objects remain highlighted even when the pointer moves away.

bool respectUI

When true, raycasts are blocked when the pointer is over UI elements.

Events

event OnObjectHighlightStart(GameObject obj)

Fired when the pointer enters an object. Return false to prevent highlighting.

event OnObjectHighlightStay(GameObject obj)

Fired every frame while the pointer remains over a highlighted object.

event OnObjectHighlightEnd(GameObject obj)

Fired when the pointer leaves a highlighted object.

event OnObjectSelected(GameObject obj)

Fired when an object is selected via click. Return false to prevent selection.

event OnObjectUnSelected(GameObject obj)

Fired when an object is deselected.

event OnObjectClicked(GameObject obj)

Fired when any object is clicked, regardless of selection state.

Methods

void SelectObject(Transform t)

Programmatically selects an object.

void SelectObjects(Transform[] objects)

Selects multiple objects at once.

void SelectObjects(List<Transform> objects)

Selects multiple objects from a list.

void ToggleObject(Transform t)

Toggles the selection state of an object.

void UnselectObject(Transform t)

Deselects a specific object.

static DeselectAll void ()

Deselects all currently selected objects in the scene.

static GetCamera Camera ()

Returns the active camera used for raycasting.

HighlightTrigger

MonoBehaviour — Per-object trigger component for highlight interaction. Unlike HighlightManager (scene-wide), HighlightTrigger provides per-object control over input detection including collider-based and volume-based triggers.

Properties

bool highlightOnHover

When true, the object highlights when the pointer hovers over it.

TriggerMode triggerMode

Detection method for the trigger (ColliderEventsOnlyOnThisObject, RaycastOnThisObjectAndChildren, Volume).

Camera raycastCamera

Camera used for raycasting. Defaults to Camera.main.

RayCastSource raycastSource

Input source for raycasting (MousePosition, ScreenCenter).

bool selectOnClick

Enables selection on click/tap for this specific object.

HighlightProfile selectedProfile

Profile applied when the object is selected.

bool singleSelection

When true, selecting this object deselects all others.

bool toggle

When true, clicking toggles the selection state.

LayerMask volumeLayerMask

Layer mask for volume-based trigger detection.

HighlightEffect highlightEffect read-only

Returns the associated HighlightEffect component.

Events

event OnObjectHighlightStart(GameObject obj)

Fired when this object begins highlighting.

event OnObjectHighlightStay(GameObject obj)

Fired every frame while this object is highlighted.

event OnObjectHighlightEnd(GameObject obj)

Fired when the highlight is removed from this object.

event OnObjectSelected(GameObject obj)

Fired when this object is selected.

event OnObjectUnSelected(GameObject obj)

Fired when this object is deselected.

event OnObjectClicked(GameObject obj)

Fired when this object is clicked.

Code Examples

Basic Highlight Configuration

using UnityEngine;
using HighlightPlus;

public class HighlightSetup : MonoBehaviour
{
    void Start()
    {
        HighlightEffect effect = gameObject.AddComponent<HighlightEffect>();

        // Outline
        effect.outline = 1f;
        effect.outlineColor = Color.cyan;
        effect.outlineWidth = 0.8f;
        effect.outlineQuality = QualityLevel.High;

        // Outer glow
        effect.glow = 1f;
        effect.glowHQColor = new Color(0f, 0.5f, 1f);
        effect.glowWidth = 0.6f;

        // See-through
        effect.seeThrough = SeeThroughMode.WhenHighlighted;
        effect.seeThroughTintColor = new Color(0f, 0.5f, 1f, 0.3f);
        effect.seeThroughIntensity = 0.8f;

        // Apply and highlight
        effect.UpdateMaterialProperties();
        effect.highlighted = true;
    }
}

Hit FX on Damage

using UnityEngine;
using HighlightPlus;

public class DamageFlash : MonoBehaviour
{
    HighlightEffect effect;

    void Awake()
    {
        effect = GetComponent<HighlightEffect>();
    }

    public void TakeDamage(float amount, Vector3 hitPoint)
    {
        // Full-object hit flash
        effect.HitFX(Color.red, 0.3f, 1f);

        // Or localized hit at impact point
        effect.HitFX(Color.red, 0.3f, 1f, hitPoint, 0.5f);
    }
}

HighlightManager Selection Handling

using UnityEngine;
using HighlightPlus;

public class SelectionHandler : MonoBehaviour
{
    void Start()
    {
        HighlightManager manager = HighlightManager.instance;
        manager.OnObjectSelected += OnSelected;
        manager.OnObjectUnSelected += OnDeselected;
        manager.OnObjectHighlightStart += OnHover;
    }

    bool OnSelected(GameObject obj)
    {
        Debug.Log($"Selected: {obj.name}");
        return true; // Allow selection
    }

    bool OnDeselected(GameObject obj)
    {
        Debug.Log($"Deselected: {obj.name}");
        return true; // Allow deselection
    }

    bool OnHover(GameObject obj)
    {
        // Return false to prevent highlighting specific objects
        if (obj.CompareTag("Locked"))
            return false;
        return true;
    }
}

Profile Switching

using UnityEngine;
using HighlightPlus;

public class ProfileSwitcher : MonoBehaviour
{
    public HighlightProfile normalProfile;
    public HighlightProfile dangerProfile;

    HighlightEffect effect;

    void Awake()
    {
        effect = GetComponent<HighlightEffect>();
    }

    public void SetDangerMode(bool danger)
    {
        effect.ProfileLoad(danger ? dangerProfile : normalProfile);
        effect.highlighted = true;
    }
}

Label Configuration

using UnityEngine;
using HighlightPlus;

public class LabelSetup : MonoBehaviour
{
    void Start()
    {
        HighlightEffect effect = GetComponent<HighlightEffect>();
        effect.labelEnabled = true;
        effect.labelText = "Pick Up";
        effect.labelColor = Color.yellow;
        effect.labelTextSize = 16;
        effect.labelMode = LabelMode.WhenHighlighted;
        effect.labelFollowCursor = false;
        effect.labelVerticalOffset = 1.5f;
        effect.labelMaxDistance = 30f;
        effect.labelFadeStartDistance = 20f;
        effect.UpdateMaterialProperties();
    }
}
Was this page helpful?