Navigation
API > API/Runtime > API/Runtime/UMG
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]
| Name | UWidgetComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/UMG/Public/Components/WidgetComponent.h |
| Include Path | #include "Components/WidgetComponent.h" |
Syntax
UCLASS (Blueprintable, ClassGroup="UserInterface",
HideCategories=(Object, Activation, "Components|Activation", Sockets, Base, Lighting, LOD, Mesh),
EditInlineNew, Meta=(BlueprintSpawnableComponent), MinimalAPI)
class UWidgetComponent : public UMeshComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → UPrimitiveComponent → UMeshComponent → UWidgetComponent
Implements Interfaces
- IAsyncPhysicsStateProcessor
- IInterface_AssetUserData
- IInterface_AsyncCompilation
- INavRelevantInterface
- IPhysicsComponent
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UWidgetComponent
(
const FObjectInitializer& ObjectInitializer |
Components/WidgetComponent.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FOnMaterialInstanceUpdated | TMulticastDelegate_NoParams< void > | Components/WidgetComponent.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| WidgetHitTester | TSharedPtr< class FWidget3DHitTester > | The hit tester to use for this component | Components/WidgetComponent.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| OnMaterialInstanceUpdated | FOnMaterialInstanceUpdated | Components/WidgetComponent.h |
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bOnWidgetVisibilityChangedRegistered | bool | Components/WidgetComponent.h | ||
| bRenderCleared | bool | Set to true after a draw of an empty component. | Components/WidgetComponent.h | |
| CurrentSlateWidget | TWeakPtr< SWidget > | The slate widget currently being drawn. | Components/WidgetComponent.h | |
| SlateWidget | TSharedPtr< SWidget > | The Slate widget to be displayed by this component. | Components/WidgetComponent.h | |
| UsersEnteredWorldWidget | TSet< int32 > | The Slate user ids of the users which have entered our world-space widget (and thus could've gotten focus). | Components/WidgetComponent.h | |
| Widget | TObjectPtr< UUserWidget > | The User Widget object displayed and managed by this component | Components/WidgetComponent.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ApplyComponentInstanceData
(
FWidgetComponentInstanceData* ComponentInstanceData |
Components/WidgetComponent.h | ||
EWidgetBlendMode GetBlendMode() |
Gets the blend mode for the widget. | Components/WidgetComponent.h | |
FVector2D GetCurrentDrawSize() |
Returns the "actual" draw size of the quad in the world | Components/WidgetComponent.h |
|
double GetCylinderArcAngle() |
Defines the curvature of the widget component when using EWidgetGeometryMode::Cylinder; ignored otherwise. | Components/WidgetComponent.h |
|
TTuple< FVector, FVector2D > GetCylinderHitLocation
(
FVector WorldHitLocation, |
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. | Components/WidgetComponent.h | |
bool GetDrawAtDesiredSize() |
Components/WidgetComponent.h |
|
|
FVector2D GetDrawSize() |
Returns the "specified" draw size of the quad in the world | Components/WidgetComponent.h |
|
bool GetEditTimeUsable() |
Components/WidgetComponent.h | ||
| Components/WidgetComponent.h |
|
||
TArray< FWidgetAndPointer > GetHitWidgetPath
(
FVector WorldHitLocation, |
Returns the list of widgets with their geometry and the cursor position transformed into this Widget component's space. | Components/WidgetComponent.h | |
TArray< FWidgetAndPointer > GetHitWidgetPath
(
FVector2D WidgetSpaceHitCoordinate, |
Returns the list of widgets with their geometry and the cursor position transformed into this Widget space. | Components/WidgetComponent.h | |
FVector2D GetLastLocalHitLocation() |
Gets the last local location that was hit | Components/WidgetComponent.h | |
virtual void GetLocalHitLocation
(
FVector WorldHitLocation, |
Converts a world-space hit result to a hit location on the widget | Components/WidgetComponent.h | |
bool GetManuallyRedraw () |
Components/WidgetComponent.h |
|
|
UMaterialInstanceDynamic * GetMaterialInstance() |
Returns the dynamic material instance used to render the user widget | Components/WidgetComponent.h |
|
ULocalPlayer * GetOwnerPlayer() |
Gets the local player that owns this widget component. | Components/WidgetComponent.h |
|
FVector2D GetPivot() |
Returns the pivot point where the UI is rendered about the origin. | Components/WidgetComponent.h |
|
bool GetReceiveHardwareInput() |
Components/WidgetComponent.h | ||
float GetRedrawTime() |
Components/WidgetComponent.h |
|
|
UTextureRenderTarget2D * GetRenderTarget() |
Returns the render target to which the user widget is rendered | Components/WidgetComponent.h |
|
const TSharedPtr< SWidget > & GetSlateWidget() |
Returns the Slate widget that was assigned to this component, if any | Components/WidgetComponent.h | |
TSharedPtr< SWindow > GetSlateWindow() |
Returns the window containing the user widget content | Components/WidgetComponent.h | |
bool GetTickWhenOffscreen() |
Gets whether the widget ticks when offscreen or not | Components/WidgetComponent.h |
|
bool GetTwoSided() |
Gets whether the widget is two-sided or not | Components/WidgetComponent.h |
|
UUserWidget * GetUserWidgetObject() |
Returns the user widget object displayed by this component | Components/WidgetComponent.h |
|
TSharedPtr< SWindow > GetVirtualWindow() |
Get the fake window we create for widgets displayed in the world. | Components/WidgetComponent.h | |
virtual UUserWidget * GetWidget () |
Gets the widget that is used by this Widget Component. | Components/WidgetComponent.h |
|
TSubclassOf< UUserWidget > GetWidgetClass() |
Returns the class of the user widget displayed by this component | Components/WidgetComponent.h | |
EWidgetSpace GetWidgetSpace() |
Components/WidgetComponent.h |
|
|
bool GetWindowFocusable () |
Components/WidgetComponent.h |
|
|
EWindowVisibility GetWindowVisiblility() |
Gets the visibility of the virtual window created to host the widget focusable. | Components/WidgetComponent.h |
|
virtual void InitWidget() |
Ensures the user widget is initialized | Components/WidgetComponent.h | |
bool IsWidgetVisible() |
Returns true if the the Slate window is visible and that the widget is also visible, false otherwise. | Components/WidgetComponent.h |
|
virtual FVector2D ModifyProjectedLocalPosition
(
const FGeometry& ViewportGeometry, |
Hook to allow this component modify the local position of the widget after it has been projected from world space to screen space. | Components/WidgetComponent.h | |
void OnWorldUserEntered
(
int32 SlateUserIndex |
To be called when a SlateUser enters this world space widget. | Components/WidgetComponent.h | |
virtual void ReleaseResources() |
Release resources associated with the widget. | Components/WidgetComponent.h | |
virtual void RequestRedraw() |
Requests that the widget be redrawn. | Components/WidgetComponent.h |
|
virtual void RequestRenderUpdate() |
Requests that the widget have it's render target updated, if TickMode is disabled, this will force a tick to happen to update the render target. | Components/WidgetComponent.h |
|
void SetBackgroundColor
(
const FLinearColor NewBackgroundColor |
Sets the background color and opacityscale for this widget | Components/WidgetComponent.h |
|
void SetBlendMode
(
const EWidgetBlendMode NewBlendMode |
Sets the blend mode to use for this widget | Components/WidgetComponent.h | |
void SetCylinderArcAngle
(
const double InCylinderArcAngle |
Defines the curvature of the widget component when using EWidgetGeometryMode::Cylinder; ignored otherwise. | Components/WidgetComponent.h |
|
void SetDrawAtDesiredSize
(
bool bInDrawAtDesiredSize |
Components/WidgetComponent.h |
|
|
void SetDrawSize
(
FVector2D Size |
Sets the draw size of the quad in the world | Components/WidgetComponent.h |
|
void SetEditTimeUsable
(
bool Value |
Components/WidgetComponent.h | ||
void SetGeometryMode
(
EWidgetGeometryMode InGeometryMode |
Components/WidgetComponent.h |
|
|
void SetInitialLayerZOrder
(
int32 NewLayerZOrder |
Sets layer z order used when this widget is initialized | Components/WidgetComponent.h | |
void SetInitialSharedLayerName
(
FName NewSharedLayerName |
Sets shared layer name used when this widget is initialized | Components/WidgetComponent.h | |
void SetManuallyRedraw
(
bool bUseManualRedraw |
Components/WidgetComponent.h |
|
|
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) | Components/WidgetComponent.h | |
void SetOwnerPlayer
(
ULocalPlayer* LocalPlayer |
Sets the local player that owns this widget component. | Components/WidgetComponent.h |
|
void SetPivot
(
const FVector2D& InPivot |
Components/WidgetComponent.h |
|
|
void SetRedrawTime
(
float InRedrawTime |
Components/WidgetComponent.h |
|
|
virtual void SetSlateWidget
(
const TSharedPtr< SWidget >& InSlateWidget |
Sets a Slate widget to be rendered. | Components/WidgetComponent.h | |
void SetTickMode
(
ETickMode InTickMode |
Sets the Tick mode of the Widget Component. | Components/WidgetComponent.h |
|
void SetTickWhenOffscreen
(
const bool bWantTickWhenOffscreen |
Sets whether the widget ticks when offscreen or not | Components/WidgetComponent.h |
|
void SetTintColorAndOpacity
(
const FLinearColor NewTintColorAndOpacity |
Sets the tint color and opacity scale for this widget | Components/WidgetComponent.h |
|
void SetTwoSided
(
const bool bWantTwoSided |
Sets whether the widget is two-sided or not | Components/WidgetComponent.h |
|
virtual void SetWidget
(
UUserWidget* Widget |
Sets the widget to use directly. | Components/WidgetComponent.h |
|
void SetWidgetClass
(
TSubclassOf< UUserWidget > InWidgetClass |
Sets the widget class used to generate the widget for this component | Components/WidgetComponent.h | |
void SetWidgetSpace
(
EWidgetSpace NewSpace |
Components/WidgetComponent.h |
|
|
void SetWindowFocusable
(
bool bInWindowFocusable |
Components/WidgetComponent.h |
|
|
void SetWindowVisibility
(
EWindowVisibility InVisibility |
Sets the visibility of the virtual window created to host the widget focusable. | Components/WidgetComponent.h |
|
void UpdateBodySetup
(
bool bDrawSizeChanged |
Ensures the body setup is initialized and updates it if needed. | Components/WidgetComponent.h | |
void UpdateMaterialInstanceParameters() |
Updates the dynamic parameters on the material instance, without re-creating it | Components/WidgetComponent.h | |
virtual void UpdateRenderTarget
(
FIntPoint DesiredRenderTargetSize |
Ensure the render target is initialized and updates it if needed. | Components/WidgetComponent.h | |
virtual void UpdateWidget() |
Ensures the 3d window is created its size and content. | Components/WidgetComponent.h |
Overridden from UPrimitiveComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void CollectPSOPrecacheData
(
const FPSOPrecacheParams& BasePrecachePSOParams, |
Collect all the PSO precache data used by the static mesh component | Components/WidgetComponent.h | |
virtual FPrimitiveSceneProxy * CreateSceneProxy() |
UPrimitiveComponent Interface | Components/WidgetComponent.h | |
virtual UBodySetup * GetBodySetup() |
Components/WidgetComponent.h | ||
virtual FCollisionShape GetCollisionShape
(
float Inflation |
Components/WidgetComponent.h | ||
virtual UMaterialInterface * GetMaterial
(
int32 MaterialIndex |
Components/WidgetComponent.h | ||
virtual int32 GetNumMaterials() |
Components/WidgetComponent.h | ||
virtual void GetUsedMaterials
(
TArray< UMaterialInterface* >& OutMaterials, |
Components/WidgetComponent.h | ||
virtual void SetMaterial
(
int32 ElementIndex, |
Components/WidgetComponent.h |
Overridden from USceneComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FBoxSphereBounds CalcBounds
(
const FTransform& LocalToWorld |
Components/WidgetComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginPlay() |
UActorComponent Interface | Components/WidgetComponent.h | |
virtual void DestroyComponent
(
bool bPromoteChildren |
Components/WidgetComponent.h | ||
virtual void EndPlay
(
const EEndPlayReason::Type EndPlayReason |
Components/WidgetComponent.h | ||
virtual TStructOnScope< FActorComponentInstanceData > GetComponentInstanceData() |
Components/WidgetComponent.h | ||
virtual void OnRegister() |
Components/WidgetComponent.h | ||
virtual void OnUnregister() |
Components/WidgetComponent.h | ||
virtual void TickComponent
(
float DeltaTime, |
Components/WidgetComponent.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool CanEditChange
(
const FProperty* InProperty |
Components/WidgetComponent.h | ||
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Components/WidgetComponent.h | ||
virtual void PostLoad() |
Components/WidgetComponent.h | ||
virtual void Serialize
(
FArchive& Ar |
Components/WidgetComponent.h |
Overridden from UObjectBaseUtility
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool CanBeInCluster() |
Components/WidgetComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool CanReceiveHardwareInput() |
Just because the user attempts to receive hardware input does not mean it's possible. | Components/WidgetComponent.h | |
double ComputeComponentWidth() |
Returns the width of the widget component taking GeometryMode into account. | Components/WidgetComponent.h | |
virtual void DrawWidgetToRenderTarget
(
float DeltaTime |
Draws the current widget to the render target if possible. | Components/WidgetComponent.h | |
double GetCurrentTime() |
Returns current absolute time, respecting TimingPolicy. | Components/WidgetComponent.h | |
| Components/WidgetComponent.h | |||
void RegisterHitTesterWithViewport
(
TSharedPtr< SViewport > ViewportWidget |
Components/WidgetComponent.h | ||
void RegisterWindow() |
Components/WidgetComponent.h | ||
void RemoveWidgetFromScreen() |
Components/WidgetComponent.h | ||
virtual bool ShouldDrawWidget() |
Allows subclasses to control if the widget should be drawn. Called right before we draw the widget. | Components/WidgetComponent.h | |
void UnregisterHitTesterWithViewport
(
TSharedPtr< SViewport > ViewportWidget |
Components/WidgetComponent.h | ||
void UnregisterWindow() |
Components/WidgetComponent.h | ||
void UpdateMaterialInstance() |
Components/WidgetComponent.h |
Overridden from USceneComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnHiddenInGameChanged() |
Components/WidgetComponent.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static EVisibility ConvertWindowVisibilityToVisibility
(
EWindowVisibility visibility |
Components/WidgetComponent.h |