Skip to content

Formation Preview Actor (Mesh)

Class · ASeinFormationPreviewActor : AActor

#include "Preview/SeinFormationPreviewActor.h"

can be subclassed in Blueprint

Draws the destination preview for a move order — the ghost markers showing where your selected units will stand if you order them here. One pooled instance lives per renderer class per local player (a mixed selection can feed several at once, each drawing its own subset), and this is the renderer picked out of the box.

This is the base of the render-backend seam: it owns everything drawing-style-agnostic (the SetPositions / HideAll API, the per-element change guards that skip redraws when nothing moved, and the quality-tag-to-tint color resolution) and delegates the actual drawing to a small set of overridable element hooks (EnsureElementCount, UpdateElement, SetElementVisible, NumElements, CommitElements). Its own hooks render a pool of flat mesh quads, which is the recommended default: a moving mesh writes velocity (or uses a masked material that does), so it does NOT ghost under Temporal Anti-Aliasing the way a moving deferred decal does while you drag the cursor.

Other looks are subclasses that override those hooks: the decal backend renders a pool of deferred decals that conform to terrain (but ghost under TAA — pair with TSR); the ISM backend uses one Instanced Static Mesh with per-instance custom-data tint, a single draw call that scales to huge formations. A project can author a fully custom backend in C++ or Blueprint (the element hooks are BlueprintNativeEvents) — e.g. a Niagara-driven look. A unit’s Navigation Renderer picks the class per unit (its presence is also the render opt-in), with the Formation Preview Actor Class setting as the project default. This is pure presentation and never mutates sim state. The quality-tint map is a generic gameplay-tag-to-color table; the framework ships it empty (a neutral preview) and a project’s preview Blueprint populates it.

Per-unit marker looks: each element carries an optional style (mesh, material, tint, size, tag) the preview subsystem resolves from the unit or group’s Navigation Renderer. The properties on this actor are the project-wide defaults; group fields override them and member fields override the group for that marker only. Renderers with no style fields use the backend defaults.

Place N elements at the given world positions and show them. Lazily grows the pool to fit; elements past Positions.Num() are hidden in place (not destroyed).

Qualities is an optional parallel array of per-position quality tags for color coding. Empty / mismatched entries fall back to NoQualityTint.

Radii is an optional parallel array of per-position footprint radii (world cm): each element’s quad/decal scales to that footprint (so the material’s ring, drawn in UV space, sizes with it). Empty / mismatched entries fall back to GroundSizeUU.

Styles is an optional parallel array of per-member marker styles resolved from the unit and group Navigation Renderers. Empty / mismatched entries render the backend’s default look. A style’s tint multiplies the quality tint, and its size override (when greater than zero) replaces the member’s footprint radius before the element hooks run.

void SetPositions(const TArray<FVector>& WorldPositions, const TArray<FGameplayTag>& Qualities, const TArray<float>& Radii, const TArray<FSeinFormationPreviewElementStyle>& Styles);

Hide every element in place without destroying it.

void HideAll();

Overridable in Blueprint, with a native default

Grow the render pool/instances so at least Count elements exist.

void EnsureElementCount(int32 Count);

Overridable in Blueprint, with a native default

Place + style element Index. Called only when its inputs changed. RadiusUU > 0 sizes the element to that footprint DIAMETER; <= 0 → uniform GroundSizeUU. Style is the member’s per-unit marker style (default-constructed when the member has none): Tint already includes its tint multiplier and RadiusUU its size override, so backends only need it for the mesh/material overrides, the style tag, or the member handle.

void UpdateElement(int32 Index, const FVector& WorldPos, const FLinearColor& Tint, float RadiusUU, const FSeinFormationPreviewElementStyle& Style);

Overridable in Blueprint, with a native default

Show / hide element Index.

void SetElementVisible(int32 Index, bool bVisible);

Overridable in Blueprint, with a native default

Current pool size (number of allocated elements).

int32 NumElements() const;

Overridable in Blueprint, with a native default

Called once after a SetPositions pass has updated/hidden every element; ActiveCount is the number now visible. Per-component backends no-op; batched backends (ISM) flush their instance buffers here (UpdateElement uses bMarkDirty=false for batching).

void CommitElements(int32 ActiveCount);

TObjectPtr<UMaterialInterface> PreviewMaterial · default nullptr

Editable in defaults and on instances · Blueprint read and write

Material drawn on each preview marker. Set it in a Blueprint subclass. The mesh backend needs a Surface material (Unlit with Masked or Translucent blending is typical) and the decal backend needs a Deferred Decal material. Empty uses an engine fallback so something shows by default.

TObjectPtr<UStaticMesh> PreviewMesh · default nullptr

Editable in defaults and on instances · Blueprint read and write

Mesh used by the mesh-style backends (base mesh + ISM). Null = the engine unit Plane (/Engine/BasicShapes/Plane), a 100uu quad scaled to the footprint. Swap for a custom ring/disc mesh to change the silhouette. Ignored by the Decal backend.

float GroundSizeUU · default 128.f · min 1.0

Editable in defaults and on instances · Blueprint read and write

Full size of each element’s ground footprint in world units (square). Set to the diameter you want — e.g. 128 cm for a roughly unit-sized marker. Used when the formation does NOT supply a per-member radius; otherwise the per-member footprint diameter wins. The material draws whatever shape it wants inside this square.

float ZOffsetUU · default 4.f

Editable in defaults and on instances · Blueprint read and write

Vertical offset added to each position — lifts the marker slightly above the ground point to avoid z-fighting with terrain. Tune per-project.

FName TintParameterName · default TEXT("Tint")

Editable in defaults and on instances · Blueprint read and write

Material vector parameter that receives the per-element quality tint. The look material should expose a Vector Parameter named this and use it as a color multiplier. Safe no-op if absent. (The ISM backend cannot use a per-instance MID, so it writes the tint to per-instance custom data floats 0–3 instead.)

FLinearColor NoQualityTint · default FLinearColor(1.f, 1.f, 1.f, 1.f)

Editable in defaults and on instances · Blueprint read and write

Tint applied where there is no quality tag for the cell (or the tag isn’t in QualityTints). White (1,1,1,1) is a no-op multiplier.

TMap<FGameplayTag, FLinearColor> QualityTints

Editable in defaults and on instances · Blueprint read and write

Quality tag → tint color. The preview subsystem fills a per-position quality tag (via USeinOrderSubsystem::PreviewQualityProvider, which a game can supply, such as a standing-point quality) and this maps it to a tint. Missing tags fall back to NoQualityTint. SHIPS EMPTY in the framework (neutral preview).