UMageItWorldMarkerWidget
Base Class: UUserWidget
Overview
Section titled “Overview”UMageItWorldMarkerWidget is the visual counterpart to the UMageItWorldMarkerComponent. It is a customized UMG (Unreal Motion Graphics) widget designed to automatically receive updates from the marker subsystem regarding its position, visibility, and interaction state.
When creating custom marker visuals in the Unreal Engine editor, your Blueprint widgets should inherit from this class to gain access to all the built-in properties and state-change events.
Blueprint Events
Section titled “Blueprint Events”The core design philosophy of this widget relies on an event-driven architecture. Instead of checking variables on Tick, you can use these events to trigger UI animations, color changes, or sound effects exactly when the state changes.
State Change Events (Blueprint Implementable)
Section titled “State Change Events (Blueprint Implementable)”OnScreenVisibilityChanged(bNewIsVisible: Boolean)Fired when the marker transitions between being visible and hidden (e.g., when obscured by world geometry or disabled).OnCrosshairFocusChanged(bNewIsUnderCrosshair: Boolean)Fired when the player’s crosshair enters or leaves the marker’s interaction radius. Ideal for hover effects.OnInFocusRadiusChanged(bNewIsInFocusRadius: Boolean)Fired when the marker enters or leaves the broader screen-center focus area.OnScreenSideChanged(NewScreenSide: ETargetScreenSide)Fired when an off-screen marker moves from one edge of the screen to another (Top, Bottom, Left, Right). Useful for updating directional arrows.OnPositionChanged(NewPosition: FVector2D)Fired when the marker’s 2D screen coordinates change.OnCreatedFired once when the widget is fully initialized by the subsystem.OnUpdatedFired every time the widget receives a general data update from the subsystem.
Native Events (Can be overridden)
Section titled “Native Events (Can be overridden)”Update(Position: FVector2D, bNewIsOnScreen: Boolean, Angle: Float, NewScreenSide: ETargetScreenSide, bNewIsInFocusRadius: Boolean)The core update function called by the subsystem. You can override this in Blueprint if you need to intercept and modify the raw update data before the widget applies it.DestroyWidgetCalled when the widget is about to be removed. Override this to play a “fade out” or destruction animation before the widget is completely removed from the screen.
Read-Only Properties
Section titled “Read-Only Properties”These variables are automatically updated by the subsystem and are exposed to Blueprints (BlueprintReadOnly) so you can bind them directly to UI elements (like progress bars, text, or render transforms).
State Flags
Section titled “State Flags”bVisible(Boolean): Is the marker currently visible?bIsOnScreen(Boolean): Is the target 3D location currently within the camera’s view frustum?bIsInFocusRadius(Boolean): Is the marker near the center focus area?
Contextual Data
Section titled “Contextual Data”TargetAngle(Float): The angle pointing toward the 3D target when it is off-screen.ScreenSide(ETargetScreenSide): The edge of the screen the widget is currently clamped to.MarkerComponent(UMageItWorldMarkerComponentreference): A weak pointer back to the 3D component that spawned this widget. Useful for retrieving custom data like health, names, or icons from the actor.
C++ API
Section titled “C++ API”If you are extending this class in C++, there are a few additional utilities available:
FOnWidgetBeforeDestroy OnWidgetBeforeDestroyA C++ delegate fired right before the widget is safely removed. The subsystem binds to this to clean up references.SetZOrder(int32 InZOrder)Dynamically updates the widget’s Z-Order on the canvas, ensuring focused or important markers render on top of others.