Language:
Discover
By Skill Level
By Category

UWidgetComponent

Choose your OS:

Inheritance Hierarchy

Syntax

class UWidgetComponent : public UMeshComponent

Remarks

The widget component provides a surface in the 3D environment on which to render widgets normally rendered to the screen. Widgets are first rendered to a render target, then that render target is displayed in the world.

Material Properties set by this component on whatever material overrides the default. SlateUI [Texture] BackColor [Vector] TintColorAndOpacity [Vector] OpacityFromTexture [Scalar]

Variables

Name Description

Protected variable

FLinearColor

 

BackgroundColor

The background color of the component

Protected variable

bool

 

bAddedToScreen

Protected variable

bool

 

bDrawAtDesiredSize

Causes the render target to automatically match the desired size.

Protected variable

bool

 

bEditTimeUsable

Allows the widget component to be used at editor time. For use in the VR-Editor.

Protected variable

bool

 

bIsTwoSided

Is the component visible from behind?

Protected variable

EWidgetBlendMod ...

 

BlendMode

The blend mode for the widget.

Protected variable

bool

 

bManuallyRedraw

Should we wait to be told to redraw to actually draw?

Protected variable

UBodySetup *...

 

BodySetup

The body setup of the displayed quad

Protected variable

bool

 

bReceiveHardwareInput

Register with the viewport for hardware input from the true mouse and keyboard.

Protected variable

bool

 

bRedrawRequested

Has anyone requested we redraw?

Protected variable

bool

 

bWindowFocusable

Is the virtual window created to host the widget focusable?

Protected variable

FIntPoint

 

CurrentDrawSize

The actual draw size, this changes based on DrawSize - or the desired size of the widget if bDrawAtDesiredSize is true.

Protected variable

TWeakPtr < SWidg ...

 

CurrentSlateWidget

The slate widget currently being drawn.

Protected variable

float

 

CylinderArcAngle

Curvature of a cylindrical widget in degrees.

Protected variable

FIntPoint

 

DrawSize

The size of the displayed quad.

Protected variable

EWidgetGeometry ...

 

GeometryMode

Controls the geometry of the widget component. See EWidgetGeometryMode.

Protected variable

FVector2D

 

LastLocalHitLocation

The relative location of the last hit on this component

Protected variable

double

 

LastWidgetRenderTime

What was the last time we rendered the widget?

Protected variable

int32

 

LayerZOrder

ZOrder the layer will be created on, note this only matters on the first time a new layer is created, subsequent additions to the same layer will use the initially defined ZOrder

Protected variable

UMaterialInterf ...

 

MaskedMaterial

The material instance for masked widget components.

Protected variable

UMaterialInterf ...

 

MaskedMaterial_OneSided

The material instance for masked, one-sided widget components.

Protected variable

UMaterialInstan ...

 

MaterialInstance

The dynamic instance of the material that the render target is attached to

Protected variable

float

 

OpacityFromTexture

Sets the amount of opacity from the widget's UI texture to use when rendering the translucent or masked UI to the viewport (0.0-1.0)

Protected variable

UMaterialInterf ...

 

OpaqueMaterial

The material instance for opaque widget components

Protected variable

UMaterialInterf ...

 

OpaqueMaterial_OneSided

The material instance for opaque, one-sided widget components

Protected variable

ULocalPlayer &#...

 

OwnerPlayer

The owner player for a widget component, if this widget is drawn on the screen, this controls what player's screen it appears on for split screen, if not set, users player 0.

Protected variable

FVector2D

 

Pivot

The Alignment/Pivot point that the widget is placed at relative to the position.

Protected variable

float

 

RedrawTime

The time in between draws, if 0 - we would redraw every frame.

Protected variable

UTextureRenderT ...

 

RenderTarget

The target to which the user widget is rendered

Protected variable

FName

 

SharedLayerName

Layer Name the widget will live on

Protected variable

TSharedPtr < SWi ...

 

SlateWidget

The Slate widget to be displayed by this component.

Protected variable

TSharedPtr < cla...

 

SlateWindow

The slate window that contains the user widget content

Protected variable

EWidgetSpace

 

Space

The coordinate space in which to render the widget

Protected variable

bool

 

TickWhenOffscreen

Should the component tick the widget when it's off screen?

Protected variable

EWidgetTimingPo ...

 

TimingPolicy

How this widget should deal with timing, pausing, etc.

Protected variable

FLinearColor

 

TintColorAndOpacity

Tint color and opacity for this component

Protected variable

UMaterialInterf ...

 

TranslucentMaterial

The material instance for translucent widget components

Protected variable

UMaterialInterf ...

 

TranslucentMaterial_OneSided

The material instance for translucent, one-sided widget components

Protected variable

UUserWidget ...

 

Widget

The User Widget object displayed and managed by this component

Protected variable

TSubclassOf < UU ...

 

WidgetClass

The class of User Widget to create and display an instance of

Protected variable

TSharedPtr < cla...

 

WidgetRenderer

Helper class for drawing widgets to a render target.

Constructors

Name Description

Public function

UWidgetComponent

(
    const FObjectInitializer & ObjectIn...
)

Functions

Name Description

Public function

void

 

ApplyComponentInstanceData

(
    FWidgetComponentInstanceData* ...
)

Protected function

bool

 

CanReceiveHardwareInput()

Just because the user attempts to receive hardware input does not mean it's possible.

Protected function

float

 

ComputeComponentWidth()

The width of the widget component taking GeometryMode into account.

Protected function Virtual

void

 

DrawWidgetToRenderTarget

(
    float DeltaTime
)

Draws the current widget to the render target if possible.

Public function

EWidgetBlend ...

 

GetBlendMode()

Gets the blend mode for the widget.

Protected function

double

 

GetCurrentTime()

Returns current absolute time, respecting TimingPolicy.

Public function

float

 

GetCylinderArcAngle()

Defines the curvature of the widget component when using EWidgetGeometryMode::Cylinder ; ignored otherwise.

Public function

TTuple < FVec ...

 

GetCylinderHitLocation

(
    FVector WorldHitLocation,
    FVector WorldHitDirection
)

When using EWidgetGeometryMode::Cylinder , continues the trace from the front face of the widget component into the cylindrical geometry and returns adjusted hit results information.

Public function

bool

 

GetDrawAtDesiredSize()

Public function

FVector2D

 

GetDrawSize()

The draw size of the quad in the world

Public function

bool

 

GetEditTimeUsable()

Public function

EWidgetGeome ...

 

GetGeometryMode()

Public function

TArray < FWid ...

 

GetHitWidgetPath

(
    FVector WorldHitLocation,
    bool bIgnoreEnabledStatus,
    float CursorRadius
)

List of widgets with their geometry and the cursor position transformed into this Widget component's space.

Public function

TArray < FWid ...

 

GetHitWidgetPath

(
    FVector2D WidgetSpaceHitCoordinate,
    bool bIgnoreEnabledStatus,
    float CursorRadius
)

List of widgets with their geometry and the cursor position transformed into this Widget space.

Public function

FVector2D

 

GetLastLocalHitLocation()

Gets the last local location that was hit

Public function Virtual

void

 

GetLocalHitLocation

(
    FVector WorldHitLocation,
    FVector2D & OutLocalHitLocation
)

Converts a world-space hit result to a hit location on the widget

Public function

UMaterialIns ...

 

GetMaterialInstance()

The dynamic material instance used to render the user widget

Public function

ULocalPlayer ...

 

GetOwnerPlayer()

Gets the local player that owns this widget component.

Public function

FVector2D

 

GetPivot()

The pivot point where the UI is rendered about the origin.

Public function

bool

 

GetReceiveHardwareInput()

Public function

float

 

GetRedrawTime()

Public function

UTextureRend ...

 

GetRenderTarget()

The render target to which the user widget is rendered

Public function

const TShare ...

 

GetSlateWidget()

Returns the Slate widget that was assigned to this component, if any

Public function

TSharedPtr < ...

 

GetSlateWindow()

The window containing the user widget content

Public function

UUserWidget ...

 

GetUserWidgetObject()

The user widget object displayed by this component

Public function

TSharedPtr < ...

 

GetVirtualWindow()

Get the fake window we create for widgets displayed in the world.

Public function

TSubclassOf <...

 

GetWidgetClass()

The class of the user widget displayed by this component

Public function

EWidgetSpace

 

GetWidgetSpace()

Public function Virtual

void

 

InitWidget()

Ensures the user widget is initialized

Protected function

void

 

RegisterHitTesterWithViewport

(
    TSharedPtr < SViewport > ViewportWid...
)

Protected function

void

 

RegisterWindow()

Public function Virtual

void

 

ReleaseResources()

Release resources associated with the widget.

Protected function

void

 

RemoveWidgetFromScreen()

Public function Virtual

void

 

RequestRedraw()

Requests that the widget be redrawn.

Public function

void

 

SetBackgroundColor

(
    const FLinearColor NewBackgroundCol...
)

Sets the background color and opacityscale for this widget

Public function

void

 

SetBlendMode

(
    const EWidgetBlendMode NewBlendMode
)

Sets the blend mode to use for this widget

Public function

void

 

SetDrawAtDesiredSize

(
    bool InbDrawAtDesiredSize
)

Public function

void

 

SetDrawSize

(
    FVector2D Size
)

Sets the draw size of the quad in the world

Public function

void

 

SetEditTimeUsable

(
    bool Value
)

Public function

void

 

SetOpacityFromTexture

(
    const float NewOpacityFromTexture
)

Sets how much opacity from the UI widget's texture alpha is used when rendering to the viewport (0.0-1.0)

Public function

void

 

SetOwnerPlayer

(
    ULocalPlayer * LocalPlayer
)

Sets the local player that owns this widget component.

Public function

void

 

SetPivot

(
    const FVector2D & InPivot
)

Public function

void

 

SetRedrawTime

(
    float bInRedrawTime
)

Public function Virtual

void

 

SetSlateWidget

(
    const TSharedPtr < SWidget >& InSla...
)

Sets a Slate widget to be rendered.

Public function

void

 

SetTintColorAndOpacity

(
    const FLinearColor NewTintColorAndO...
)

Sets the tint color and opacity scale for this widget

Public function

void

 

SetTwoSided

(
    const bool bWantTwoSided
)

Sets whether the widget is two-sided or not

Public function Virtual

void

 

SetWidget

(
    UUserWidget * Widget
)

Sets the widget to use directly.

Public function

void

 

SetWidgetClass

(
    TSubclassOf < UUserWidget > InWidget...
)

Sets the widget class used to generate the widget for this component

Public function

void

 

SetWidgetSpace

(
    EWidgetSpace NewSpace
)

Protected function Virtual

bool

 

ShouldDrawWidget()

Allows subclasses to control if the widget should be drawn. Called right before we draw the widget.

Protected function

void

 

UnregisterHitTesterWithViewport

(
    TSharedPtr < SViewport > ViewportWid...
)

Protected function

void

 

UnregisterWindow()

Public function

void

 

UpdateBodySetup

(
    bool bDrawSizeChanged
)

Ensures the body setup is initialized and updates it if needed.

Public function

void

 

UpdateMaterialInstanceParameters()

Updates the dynamic parameters on the material instance, without re-creating it

Public function Virtual

void

 

UpdateRenderTarget

(
    FIntPoint DesiredRenderTargetSize
)

Ensure the render target is initialized and updates it if needed.

Public function Virtual

void

 

UpdateWidget()

Ensures the 3d window is created its size and content.

Overridden from UPrimitiveComponent

Name Description

Public function Virtual

FPrimitiveSc ...

 

CreateSceneProxy()

UPrimitiveComponent Interface

Public function Virtual

UBodySetup &...

 

GetBodySetup()

Return the BodySetup to use for this PrimitiveComponent (single body case)

Public function Virtual

FCollisionSh ...

 

GetCollisionShape

(
    float Inflation
)

Return a CollisionShape that most closely matches this primitive.

Public function Virtual

UMaterialInt ...

 

GetMaterial

(
    int32 ElementIndex
)

Returns the material used by the element at the specified index

Public function Virtual

int32

 

GetNumMaterials()

Number of material elements in this primitive

Public function Virtual

void

 

GetUsedMaterials

(
    TArray < UMaterialInterface * > ...,
    bool bGetDebugMaterials
)

Retrieves the materials used in this component

Overridden from USceneComponent

Name Description

Public function Virtual

FBoxSphereBo ...

 

CalcBounds

(
    const FTransform & LocalToWorld
)

Calculate the bounds of the component. Default behavior is a bounding box/sphere of zero size.

Overridden from UActorComponent

Name Description

Public function Virtual

void

 

DestroyComponent

(
    bool bPromoteChildren
)

Unregister the component, remove it from its outer Actor's Components array and mark for pending kill.

Public function Virtual

void

 

EndPlay

(
    const EEndPlayReason::Type EndPlayR...
)

UActorComponent Interface

Public function Virtual

FActorCompon ...

 

GetComponentInstanceData()

Called before we throw away components during RerunConstructionScripts, to cache any data we wish to persist across that operation

Public function Virtual

void

 

OnRegister()

WITH_EDITOR.

Public function Virtual

void

 

OnUnregister()

Called when a component is unregistered.

Public function Virtual

void

 

TickComponent

(
    float DeltaTime,
    enum ELevelTick TickType,
    FActorComponentTickFunction * T...
)

Function called every frame on this ActorComponent.

Overridden from UObject

Name Description

Public function Virtual

bool

 

CanEditChange

(
    const UProperty * InProperty
)

Called by the editor to query whether a property of this object is allowed to be modified.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent & PropertyCha...
)

Called when a property on this object has been modified externally

Constants

Name

Description

WidgetHitTester

The hit tester to use for this component

References

Module

UMG

Header

Runtime/UMG/Public/Components/WidgetComponent.h