Home › Systems › AFS_Core_Highlight
System

AFS_Core_Highlight

Hover feedback in three interchangeable styles — material parameter, mesh copy and shared post-process outline — spawned on demand by interactions.

What it gives you

  • Three highlight styles with different cost and appearance
  • Automatic lifetime: no unhover event to handle
  • Shared stencil pooling for the post-process style

Requires

AFA_Sounds AFL_Libraries AFM_MeshCopy

Required by

AFM_Abilities AF_Examples

6 assets24 API members

Description

Highlighting is deliberately not built into interactions. An interaction names a Highlight Class and the framework spawns it on first hover — so an object that is never hovered never pays for the component.

The three styles trade cost against flexibility. The material style writes parameters on the object's own material and is cheapest. The mesh-copy style duplicates the geometry under a highlight material, for objects whose materials you do not control. The post-process style assigns a custom depth stencil and draws a true outline through a shared full-screen pass, pooling stencil indices by colour.

Lifetime is handled by a timeout rather than by explicit events: TickHighlight is called each frame while hovering, and the highlight ends automatically once the calls stop.

Setup

  1. On any interaction component, set Highlight Class and Highlight Color.
  2. For the post-process style, confirm Custom Depth-Stencil is enabled in Project Settings.
Warning

Custom depth is a project setting. If Custom Depth-Stencil Pass is anything but Enabled with Stencil, the post-process style silently draws nothing; the Setup window's Required page reports and fixes it (Custom depth with stencil). The other two styles are unaffected.

The three styles on identical objects
AFS_Core_Highlight_styles.pngThe three styles on identical objects
The three styles on identical objects

Usage

Choosing a style

StyleUse when
BPC_Highlight_MaterialYou control the object's material. Cheapest.
BPC_Highlight_MeshCopyYou cannot modify the material.
BPC_Highlight_PostProcessYou want a true outline and can afford the pass.

Limiting which meshes highlight

Tag the meshes and set Highlight Tag on the interaction. Leave it empty to highlight everything.

Changing colour at runtime

Call UpdateHighlightColor on the interaction component.

Key properties

PropertyWhen to change
Highlight ColorPer interaction, to signal type or state
Highlight TagTo restrict which meshes respond
Parameter Color / Parameter HighlightOn the material style, to match your material's parameter names
Sound Start / Sound StopHover feedback

Extending

See Custom highlight style. Derive from BPC_Highlight and override StartHighlight, EndHighlight and UpdateColor.

Performance notes

Performance

On mobile and standalone headsets prefer the material style. The post-process style costs a full-screen pass and requires Custom Depth-Stencil.

Example map

Map_Examples_Highlight shows all three styles side by side on identical objects.

Troubleshooting

Post-process highlights do not draw. Custom Depth-Stencil is disabled in Project Settings → Rendering.

The material style does nothing. The object's material does not expose the parameter names set in Parameter Color and Parameter Highlight.

API reference

Every blueprint asset in this module. Expand an asset to see its members.

Components

BPC_Highlight9 members
extends ActorComponent

Base highlight component, the visual half of hovering. Carries the highlight colour, the start and stop sounds and the tag deciding which meshes are affected, and ends the highlight once Tick Highlight stops arriving. An interaction adds one for you from its Highlight Class, so choose the material, mesh-copy or post-process variant there, or subclass this.

KindNameSignatureDescription
varHighlight ColorColorLinearColorColour used to highlight the object. Normally supplied by the interaction component that spawns this highlight.
varSound StartSoundSoundBaseSound played when highlighting begins.
varSound StopSoundSoundBaseSound played when highlighting ends.
varHighlight TagReferencesnameComponent tag limiting which meshes on the owner are highlighted. Leave empty to highlight every mesh.
fnEndHighlight()Ends the highlight effect and plays the stop sound. Override in a subclass to implement a new highlight style.
fnStartHighlight()Begins the highlight effect and plays the start sound. Override in a subclass to implement a new highlight style.
fngetComponentsToHighlightDefault(out MeshComponents: MeshComponent[])Returns the mesh components this highlight applies to, honouring the Highlight Tag filter.
eventTickHighlight()Keeps the highlight alive for this frame. The highlight ends automatically once these calls stop arriving, so hovering needs no explicit end event.
eventUpdateColor(HighlightColor: LinearColor)Changes the highlight colour while the highlight is running.
BPC_Highlight_Material6 members
extends BPC_Highlight

Highlight drawn through the owner's own materials, fading a scalar parameter on every dynamic material instance of the tagged meshes and writing the colour into a vector parameter. Name it as an interaction's Highlight Class when the meshes already carry highlight parameters, and set the two parameter names to match the material.

KindNameSignatureDescription
varParameter ColorSettingsnameName of the colour parameter on the object's material that this highlight writes to.
varParameter HighlightSettingsnameName of the scalar parameter on the object's material that this highlight toggles.
eventStartHighlight()Enables the highlight by driving the configured material parameters.
eventEndHighlight()Disables the highlight by resetting the configured material parameters.
eventSetHighlight(Set: bool)Sets the highlight parameter directly, bypassing the start and stop transitions.
eventUpdateColor(HighlightColor: LinearColor)Writes a new colour into the material's colour parameter.
BPC_Highlight_MeshCopy2 members
extends BPC_Highlight

Highlight drawn as a ghost duplicate of the owner's meshes, spawned as a mesh copy helper in the hologram material, leaving the owner's own materials untouched. Name it as an interaction's Highlight Class for objects whose materials cannot carry a highlight parameter.

KindNameSignatureDescription
eventEndHighlight()Overrides the base end-of-highlight step with an empty body, because this variant's mesh copy removes itself as it fades out. Nothing needs doing here unless a child adds state of its own.
eventStartHighlight()Spawns a copy of the object's meshes rendered with the highlight material. Use this style when the object's own material cannot be modified.
BPC_Highlight_PostProcess3 members
extends BPC_Highlight

Highlight drawn as an outline by a post-process pass. Finds the highlight post process actor in the level, spawning one if there is none, and asks it for a stencil index matching the highlight colour. Name it as an interaction's Highlight Class for a crisp outline; it needs custom depth, and only a few distinct colours can be live at once.

KindNameSignatureDescription
fngetPostProcessDefault(out PostProcess: BP_PostProcess_Highlight)Returns the shared post-process highlight actor, creating it if this is the first highlight in the level.
eventStartHighlight()Assigns a custom depth stencil to the object so the shared post-process pass draws an outline around it.
eventEndHighlight()Turns custom depth off on the highlighted meshes and releases this component's stencil reservation, so the colour can be reused.

Helper

BP_Helper_MeshCopy_Highlight0 members
extends BP_Helper_MeshCopy

Ghost duplicate of a highlighted actor's meshes, spawned by the mesh-copy highlight. It adds nothing to the mesh copy helper it inherits from and exists so the highlight has a class of its own to spawn and to restyle; subclass it to change how the ghost looks.

No editor-visible members; this asset configures defaults only.

PostProcess

BP_PostProcess_Highlight4 members
extends Actor

Level actor supplying the outline pass that post-process highlights are drawn with. It hands out custom depth stencil values, one per requested colour, writes those colours into the outline material and frees them again as the requesting objects go away. The first highlight that needs it spawns one, so place it yourself only to control where it sits or to change its post-process settings.

KindNameSignatureDescription
fngetOutlineMaterial(out OutlineMaterial: MaterialInstanceDynamic)Returns the dynamic material instance driving the outline post-process, so colours can be updated at runtime.
fnFreeUpUnusedStencil()Drops destroyed objects from the reservations, then frees every colour that no object holds any more, so its stencil index can be given to a new colour.
fnReleaseStencil(Reference: Object)Releases the stencil previously reserved for the given object. Its colour is freed for other colours the next time a new one is requested and nothing else uses it.
fnRequestStencilForColorDefault(RequestColor: LinearColor, Reference: Object, out Stencil: int)Reserves a custom depth stencil index (250-255) for the requested outline colour and returns it. Colours are pooled, so objects sharing a colour share a stencil; a new request from the same object replaces its old colour. When all six indices are taken, the object gets the stencil of the closest colour in use instead of no outline.