UMageItWorldMarkerComponent
Base Class: USceneComponent
Overview
Section titled “Overview”UMageItWorldMarkerComponent is the bridge between your 3D game world and your 2D UI. You attach this component to any Actor in your level (e.g., an enemy, a quest NPC, a loot drop, or a capture point).
Because it inherits from USceneComponent, it has a physical location in the 3D world. On BeginPlay, it automatically registers itself with the UMageItWorldMarkersSubsystem and provides the necessary configuration (like which UI widget to spawn, how far away it can be seen, and whether it sticks to the screen edges).
Configuration Properties (Variables)
Section titled “Configuration Properties (Variables)”These properties can be configured directly in the Details Panel of the Actor Blueprint where you added this component.
Visual & Behavior
Section titled “Visual & Behavior”WidgetClass(TSubclassOf<UMageItWorldMarkerWidget>): The specific Blueprint UI class that will be spawned to represent this marker on the screen.bStickToViewport(Boolean): If enabled, the marker will clamp to the edge of the screen when the Actor is not in the camera’s view. If disabled, the marker will disappear when looking away.MarkerSize(FVector2D): The logical dimensions of the UI widget. This is critical for calculating accurate screen edge collisions and padding.ScreenEdgeGap(FMargin): Padding applied when the marker is clamped to the edge of the screen, preventing it from clipping outside the monitor bounds.
State & Distance
Section titled “State & Distance”bEnabled(Boolean): Determines if the marker should be processed and rendered at all. Can be toggled at runtime.bCrosshairInteractionEnabled(Boolean): Allows this specific marker to respond to crosshair focus events (useful for interactive objects).MaxVisibleDistance(Float): The maximum distance (in Unreal Units / cm) from the player at which this marker is visible. Set to0.0for infinite distance.
Blueprint Functions
Section titled “Blueprint Functions”You can call these methods on the component at runtime to dynamically control its behavior.
Lifecycle & State
Section titled “Lifecycle & State”EnableMarker()/DisableMarker()Safely turns the marker on or off. This updates the subsystem and triggers visibility changes in the UI.GetMarkerWidget()Returns the instantiatedUMageItWorldMarkerWidget(UI element) associated with this component. You can cast this to your specific Blueprint widget class to update custom data (e.g., setting health bar values or changing text).HasValidMarkerWidget()Returnstrueif the UI widget has been successfully created and is currently valid.
Spatial Utilities
Section titled “Spatial Utilities”GetDistanceToPlayer()Returns the exact distance (in cm) from this component to the target player’s camera.GetDistanceToPlayerSquared()Returns the squared distance. Use this instead ofGetDistanceToPlayerwhen doing frequent comparisons (like sorting arrays) as it is significantly cheaper on the CPU since it avoids square root calculations.
Custom Logic (Blueprint Native Events)
Section titled “Custom Logic (Blueprint Native Events)”These functions can be overridden in your custom Blueprint child classes to inject your own game-specific logic.
IsVisibleForPlayer()(Returns Boolean)Override this function to add custom conditions for visibility. For example, you can make a marker visible only if the player has a specific item in their inventory, or if the enemy is fully “spotted” by teammates.IsAlwaysVisibleForPlayer()(Returns Boolean)If this returnstrue, the subsystem will skip conditional visibility checks.GetTagetPlayerController()(Returns APlayerController)By default, the component registers with the local player. Override this if you are doing complex splitscreen or spectator setups where a marker belongs to a specific controller.