Home › Systems › AFS_UI_Labels
System

AFS_UI_Labels

World-space labels attached to actors, in simple and info variants, with a helper that keeps them facing the player.

What it gives you

  • Text labels that track objects in world space
  • Simple and richer info variants
  • Automatic orientation toward the player

Requires

AFL_Libraries AFM_AutoDestroy AFM_Spline AFS_UI

Required by

AF_Examples

8 assets78 API members

Description

Labels annotate objects in the world. BPC_Label_Simple shows a single line of text; BPC_Label_Info supports a richer layout with a title, body and icon. Both use BP_Helper_Label to stay oriented toward the player and to fade with distance.

Labels are components rather than actors so they move with whatever they annotate, including objects the player is carrying.

Setup

  1. Add BPC_Label_Simple or BPC_Label_Info to the actor.
  2. Set the label text and position the component where the label should float.

Usage

Showing and hiding

Labels can be driven from an interaction — show on hover by binding to the interaction's highlight delegate, so annotation appears only when relevant.

Styling

Labels use the active theme, so they restyle with everything else.

Labels anchored to three objects at different distances
AFS_UI_Labels_result.pngLabels anchored to three objects at different distances
Labels anchored to three objects at different distances

Key properties

PropertyWhen to change
Label textThe content shown
Frame widgetSwap WBP_LabelFrame for a custom frame

Extending

Derive from WBP_Label for custom label layouts, or from BPC_Label for new label behaviours.

Performance notes

Performance

Each label is a world-space widget. Use distance fade and keep Draw Size modest when labelling many objects.

Example map

Map_Examples_Labels shows both variants on several objects.

Troubleshooting

Labels face the wrong way. The helper orients toward the local player's camera; in multiplayer confirm you are testing on the owning client.

API reference

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

Components

BPC_Label34 members
extends SceneComponent

Base label component: floating world-space UI pinned to a point on an actor. It spawns and destroys the label helper actor as it activates, and holds every setting the label uses: the leader spline and its direction, the arrow, the theme override, camera-facing rotation and hiding by distance. Add the simple or info variant, or subclass it for content of your own.

KindNameSignatureDescription
varSpline Attach Component TagAttach|SplinenameComponent tag the label searches its owner for at start-up to decide where the spline is pinned. The first matching scene component becomes the far end of the curve; with no match the spline has nothing to point at and is never drawn.
varSpline Attach SocketAttach|SplinenameSocket on the tagged attach component that the far end of the spline is pinned to. Leave it as None to use the component's own origin.
varUse SplineAttach|SplineboolWhether a curved line is drawn between the label and its attach point. Read when the label is spawned; the spawned label builds the spline mesh and collapses it again when the label is hidden.
varSpline WidthAttach|SplinefloatRadius of the spline mesh in centimetres, 0.12 by default. The spawned label multiplies it by the square root of its own world scale, so the line keeps its thickness on a scaled label.
varSpline ColorAttach|SplineLinearColorColour set on the spline material's colour parameter. Change it at runtime through Set Spline Colour, which also repaints a label that is already in the world.
varSpline Source DirectionAttach|SplineE_Label_DirectionWhich way the spline leaves the attach point: Automatic aims it straight at the label, Source Vector follows the attach component's forward vector, and Up Vector lifts it along world up. Tangent length at that end is scaled by the Spline Tangent Multiplier.
varUse ArrowAttach|ArrowboolWhether the label frame shows its pointer arrow on the edge given by Direction. Read when the label is spawned, so Set Use Arrows does not change a label that is already up.
varSpline Tangent MultiplierAttach|SplinefloatMultiplier on the tangent length at the attach end of the spline, 2.5 by default. Larger values bow the curve further out before it turns back towards the label.
varDirectionAttachE_UI_Direction_2DEdge of the label the spline and the arrow leave from, Down by default. It also picks the tangent direction at the label end of the curve, so it decides how the line bends into the frame.
varSpline MaterialAttach|SplineMaterialInterfaceMaterial the spline mesh is built with, handed to the spawned label along with the rest of the spline settings. The spline colour is set as a parameter on it, so a material with no colour parameter ignores Set Spline Colour.
varCustom ThemeThemeBP_PDA_ThemeTheme override handed to the spawned label's widget component. Leave empty to follow the theme in use across the game.
varScale CurveAuto ScaleCurveFloatCurve driving how the label scales with camera distance, passed to the label as it spawns. Leave empty to keep the label at its authored size; Update Scale Curve swaps it on a label that is already up.
varUse Automatic Disappear on DistanceDistance HideboolWhether the label hides itself while the camera sits outside the minimum and maximum disappear distances. The check runs every two seconds while the component is active, and stops entirely when the component is deactivated.
varMax Automatic Disappear DistanceDistance HidefloatDistance in centimetres beyond which the label hides itself, 500 by default. A ten per cent deadzone either side of the boundary stops it flickering on and off as you walk away.
varMin Automatic Disappear DistanceDistance HidefloatDistance in centimetres below which the label hides itself again. Leave at zero so it only ever disappears for being too far off.
varRotate to PawnAuto RotateE_Label_CameraRotationHow the spawned label turns towards the camera each frame: not at all, yaw only, yaw clamped to the Angle Limitation, or all three axes. Update Rotate changes it on a label that is already in the world.
varRotation Interpolation SpeedAuto RotatefloatSpeed at which the label interpolates round to face the camera, 4 by default. Only read while Rotate To Pawn is set to something other than No Rotation.
varAngle LimitationAuto RotatefloatMaximum yaw in degrees the label may swing away from its resting orientation, 40 by default. Only applied in the limited rotation mode, where the label follows the camera until it reaches this angle and is then clamped.
varLabel ClassClassesclass<BP_Helper_Label>Actor class spawned to carry the label in the world, normally the label helper shipped with the plugin. Every style, rotation and distance setting on the component is passed into it on spawn, and nothing appears at all while it is empty.
varLabel Widget ClassClassesclass<WBP_Label>Widget class created on the spawned label. The info and simple label components each default this to their own widget, so set it only when you have built a label widget of your own.
varLabel CollisionGeneralboolWhether the spawned label's widget surface takes part in pointer traces. Switch it off for a purely decorative label that should never swallow a laser or a touch.
varSocketProtectedST_SocketScene component and socket the far end of the spline is pinned to, normally filled in at start-up from the Spline Attach Component Tag. Set it through Update Attach Socket rather than by hand: a socket already valid at begin play skips the whole start-up path, so no label is spawned.
fnUpdateAttachSocketAttach(AttachSceneComponent: ST_Socket)Repoints the far end of the spline at another scene component and socket, forwarding the change to a label that is already in the world. Use it when the thing being labelled is built at runtime.
fnCheckToSpawnAndSetTickTick()Shows the label while the component is active and the camera is inside the disappear window, and hides it otherwise. Internal; it runs after every activation, deactivation and distance check.
fnSetDirectionStyle(Direction: E_UI_Direction_2D)Sets the edge the spline and arrow leave from and forwards it to a label already in the world, which recomputes its curve. The frame's arrow is placed when the widget is built, so it follows on the next spawn.
fnSetUseArrowsStyle(UseArrow: bool)Records whether the label frame should carry its pointer arrow. Only the stored value changes, so a label already in the world keeps the arrow it was spawned with until it is hidden and shown again.
fnSetSplineColorStyle(SplineColor: LinearColor)Recolours the spline, storing the value and pushing it straight to a label that is already in the world. Unlike the other style setters, it takes effect without respawning the label.
fnDrawDebugDisappearDistanceDisappear()Draws two white debug spheres at the minimum and maximum disappear distances and leaves them up for fifteen seconds. Meant to be pressed in the editor while placing a label, to see where it hides itself.
eventShowLabel(Set: bool)Spawns the label actor and attaches it to this component, or asks an existing one to fade out and destroy itself. Requests matching the current state are ignored, and every style, rotation and distance setting on the component is copied into the label as it spawns.
eventOnComponentActivated_Event_0(Component: ActorComponent, bReset: bool)Internal handler that starts the distance check and shows the label when the component is activated.
eventOnComponentDeactivated_Event_0(Component: ActorComponent)Internal handler that stops the distance check and hides the label when the component is deactivated.
eventCheckForAutomaticDistanceDespawn(Set: bool)Starts or stops the two second loop that measures camera distance against the minimum and maximum disappear distances and shows or hides the label as it crosses them. Passing false only stops the loop; the label keeps whatever state the last check left it in.
eventUpdateRotate(RotateToPawn: E_Label_CameraRotation)Changes how the label turns towards the camera and applies it to a label already in the world, without respawning it.
eventUpdateScaleCurve(ScaleCurve: CurveFloat)Swaps the curve driving the label's scale with distance, both on the component and on a label already in the world.
BPC_Label_Info8 members
extends BPC_Label

Label with a title, a subtitle, a body of text and a button, drawn in a collapsible frame with collision switched on. Add it to an actor that needs a full information panel next to it, and change any of the four through the matching Update calls at runtime.

KindNameSignatureDescription
varTitleContenttextHeading line of the label, reading Label until you change it. It sits in the text column that the label's button folds away, and collapses when left empty.
varSubtitleContenttextSecond line, shown under the heading in the same folding column. Leave empty for no subtitle; the block collapses rather than leaving a gap.
varContentContenttextBody text of the label, shown under the subtitle in the folding column. Leave empty to collapse the block.
varButton ContentContentST_Button_ContentText and image shown on the large button that folds the label's text column away. Change it at runtime through Update Button Content.
eventUpdateButtonContent(ButtonContent: ST_Button_Content)Replaces the text and image on the label's button and broadcasts On Content Updated, which makes the label widget re-read all four content values at once.
eventUpdateContent(TextBody: text)Replaces the body text and broadcasts On Content Updated, which makes the label widget re-read all four content values at once.
eventUpdateSubtitle(Subtitle: text)Replaces the subtitle and broadcasts On Content Updated, which makes the label widget re-read all four content values at once.
eventUpdateTitle(Title: text)Replaces the heading and broadcasts On Content Updated, which makes the label widget re-read all four content values at once.
BPC_Label_Simple2 members
extends BPC_Label

Label showing a single line of text. Add it to an actor that only needs naming, and call Update Title to change the text at runtime; it is the label nearly all the shipped examples use.

KindNameSignatureDescription
varTitleContenttextSingle line of text carried by the simple label, reading Label until you change it. It is the only content this label shows; change it at runtime through Update Title.
eventUpdateTitle(Title: text)Replaces the title and broadcasts On Content Updated, which makes the simple label widget re-read it.

Helpers

BP_Helper_Label25 members
extends Actor

Actor that actually draws a label: the widget component on a handle that turns to face the camera, the leader spline with its arrow, and the fade in and out before it destroys itself. The label component spawns one while the label should be visible, passing it every setting; subclass this and point the component's Label Class at it only when a label needs building differently.

KindNameSignatureDescription
varDirectionAttachE_UI_Direction_2DEdge of the label the spline leaves from, Left by default. It sets the tangent direction at the label end of the curve; the label component supplies it on spawn.
varUse SplineSplineboolWhether the curved line to the attach point is built. Set Spline creates the spline component and its mesh helper when it is switched on and destroys both when it is switched off.
varSpline MaterialSplineMaterialInterfaceMaterial the spline meshes are built with, handed to the spline helper as the spline is created. The spline colour is set as a parameter on it.
varSpline SizeSplinefloatRadius of the spline mesh in centimetres, 0.12 by default, multiplied by the square root of the rotate handle's world scale so the line keeps its thickness on a scaled label.
varSpline ColorSplineLinearColorColour set on the spline material's colour parameter. Set Spline Colour changes it on a spline that is already built.
varSpline Source DirectionSplineE_Label_DirectionWhich way the spline leaves the attach point: Automatic aims it at the label, Source Vector follows the attach component's forward vector, and Up Vector lifts it along world up.
varTangent MultiplierSplinefloatMultiplier on the tangent length at the attach end of the spline, 2.5 by default. Larger values bow the curve further out before it turns back towards the label.
varUse ArrowArrowboolWhether the label widget shows its pointer arrow on the attach edge, on by default. It is carried over from the label component as the helper spawns and read when the widget is built.
varThemeDesignBP_PDA_ThemeColour and font set copied into the label's widget component while the actor is constructed. Leave empty to follow the theme in use across the game.
varRotate to PawnAuto RotateE_Label_CameraRotationHow the rotate handle turns towards the camera: not at all, yaw only, yaw clamped to Max Angle, or all three axes. It is read every tick, so it can be changed while the label is up.
varRotation Interpolation SpeedAuto RotatefloatSpeed at which the rotate handle interpolates round towards the camera, 4 by default. Only read while Rotate To Pawn is something other than No Rotation.
varMax AngleAuto RotatefloatLargest yaw in degrees the rotate handle may reach relative to its parent, 40 by default. Only applied in the limited rotation mode, where the handle is clamped after each interpolation step.
varDistance Float CurveScaleCurveFloatCurve driving how the label scales with camera distance, supplied by the label component on spawn. Leave empty to keep the label at its authored size.
varLabel ComponentBPC_LabelLabel component that spawned this actor. The label widget reads it back through Get Label Component to find the content it should show, so a helper spawned by hand without one stays blank.
varLabel WidgetGeneralclass<WBP_Label>Widget class created on the widget component at begin play, taken from the label component's Label Widget Class. Nothing is drawn while it is empty.
varLabel CollisionGeneralboolWhether the label's widget surface takes part in pointer traces. It is copied into the widget component during construction, so it has to be set before the actor is spawned.
varSocketAttachST_SocketScene component and socket the far end of the spline is pinned to. The curve is only recalculated while this holds a valid component; replace it through Update Socket.
fnUpdateSocketAttach(Socket: ST_Socket)Stores a new attach component and socket for the far end of the spline. Nothing is recalculated here; the change is picked up by the next Update Spline Calculation.
fnSetDirectionAttach(Direction: E_UI_Direction_2D)Sets the edge the spline leaves the label from and recalculates the curve immediately.
fnCheckAndSetTickGeneral()Enables the actor's tick only while the label has appeared and its widget has not faded out for distance. Internal; the tick is what turns the label towards the camera.
fnUpdateSplineCalculationSpline()Recomputes both ends of the spline: the far point is pinned to the attach socket in world space, the label end sits on the frame edge given by Direction, and the tangents follow Direction and Spline Source Direction before the meshes are rebuilt. Does nothing unless the spline is switched on and the socket holds a valid component.
fnSetSplineColorSpline(SplineColor: LinearColor)Recolours the spline by setting the colour parameter on its material. Safe to call before the spline exists, since the stored colour is applied again when it is built.
fnSetSplineSizeSpline(SplineSize: float)Resizes the spline mesh at both ends, scaling the radius by the square root of the rotate handle's world scale. Stores the value but changes nothing visible while the spline is switched off or not yet built.
fnSetSplineSpline(Set: bool)Builds or tears down the spline. Switching it on adds a spline component under the rotate handle, gives it two points, spawns the spline mesh helper and runs the first curve calculation; switching it off destroys both the component and the helper.
eventShow(Set: bool)Fades the label in or out. Showing expands the spline and then reveals the widget; hiding reverses both and destroys the actor a second later, so a hidden label is gone rather than dormant. Calls matching the current state are ignored.

Widgets

WBP_Label1 members
extends WBP_Base

Root class for every label widget. Get Label Component walks back through the label helper actor that owns the widget to the label component that spawned it, which is how a label reads its content. Inherit from this, or from the simple or info variant, for a label of your own and point the label component's Label Widget Class at it.

KindNameSignatureDescription
fngetLabelComponent(out LabelComponent: BPC_Label)Returns the label component behind this widget, reached through the owning actor of the widget component it sits on. Comes back empty whenever the widget is not hosted on a label, as in the designer preview.
WBP_Label_Info2 members
extends WBP_Label

Label widget laying out a title, subtitle and body inside the label frame, with a large button that collapses and expands the body. It reads all four from the info label component whenever the content changes. Copy or subclass it for a panel of your own rather than editing it in place.

KindNameSignatureDescription
eventWidgetElement_PostInitiateStyle()Called by the widget system once the whole tree has been initiated and themed. Left empty on this label, whose text blocks are filled through On Content Updated instead.
eventOnContentUpdated_Event()Re-reads the title, subtitle, body text and button content from the info label component and pushes each into its widget. Runs whenever that component broadcasts On Content Updated, and text blocks left empty collapse individually.
WBP_Label_Simple2 members
extends WBP_Label

Label widget showing one line of title text in the label frame, read back from the simple label component whenever the content changes. It is the widget class the simple label defaults to; copy it as the starting point for a small label of your own.

KindNameSignatureDescription
eventOnContentUpdated_Event()Re-reads the title from the simple label component and pushes it into the text block, which collapses when the title is empty. Runs whenever that component broadcasts On Content Updated.
eventWidgetElement_PostInitiateStyle()Called by the widget system once the whole tree has been initiated and themed. Left empty on this label, whose single text block is filled through On Content Updated instead.

Widgets/Frame

WBP_LabelFrame4 members
extends WBP_Base

Rounded frame with a pointer arrow, shared by the label widgets. Content goes in its named slot, and Set Direction moves the arrow to the chosen edge and turns it so it points back at the thing being labelled. Use it as the outer frame of a label widget of your own.

KindNameSignatureDescription
fnWidgetElement_getNamedSlotsSlots(out Slots: NamedSlot[])Returns the frame's single content slot, so that whatever you drop inside the rounded border is initialised and themed with the rest of the tree.
eventWidgetElement_UpdateThemeStyle(Theme: BP_PDA_Theme, Desktop: bool)Called on every element when a theme is applied to the widget tree. Left empty here, since the rounded border reads the theme in its own right and the arrow is a fixed texture.
eventSetDirection(UseDirection: bool, Direction: E_UI_Direction_2D)Moves the arrow to the middle of one of the frame's four edges and turns it to point outwards along that edge. Pass Use Direction as false to collapse the arrow and leave a plain frame.
eventWidgetElement_PostInitiateStyle()Called by the widget system once the whole tree has been initiated and themed. Nothing extra runs for the frame; override it in your own frame for set-up that needs the finished tree.