UWidgetLayoutLibrary

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

UMG

Header

/Engine/Source/Runtime/UMG/Public/Blueprint/WidgetLayoutLibrary.h

Include

#include "Blueprint/WidgetLayoutLibrary.h"

Syntax

class UWidgetLayoutLibrary : public UBlueprintFunctionLibrary

Constructors

Name Description

Public function

UWidgetLayoutLibrary

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Static

FVector2D

 

GetMousePositionOnPlatform()

Gets the platform's mouse cursor position. This is the 'absolute' desktop location of the mouse.

Public function Static

FVector2D

 

GetMousePositionOnViewport

(
    UObject* WorldContextObject
)

Gets the platform's mouse cursor position in the local space of the viewport widget.

Public function Static

bool

 

GetMousePositionScaledByDPI

(
    APlayerController* Player,
    double& LocationX,
    double& LocationY
)

Public function Static

FGeometry

 

GetPlayerScreenWidgetGeometry

(
    APlayerController* PlayerContr...
)

Gets the geometry of the widget holding all widgets added to the "Player Screen".

Public function Static

float

 

GetViewportScale

(
    UObject* WorldContextObject
)

Gets the current DPI Scale being applied to the viewport and all the Widgets.

Public function Static

float

 

GetViewportScale

(
    UGameViewportClient* ViewportC...
)

Gets the current DPI Scale being applied to the viewport and all the Widgets.

Public function Static

FVector2D

 

GetViewportSize

(
    UObject* WorldContextObject
)

Gets the size of the game viewport.

Public function Static

FGeometry

 

GetViewportWidgetGeometry

(
    UObject* WorldContextObject
)

Gets the geometry of the widget holding all widgets added to the "Viewport".

Public function Static

bool

 

ProjectWorldLocationToWidgetPosition

(
    APlayerController* PlayerContr...,
    FVector WorldLocation,
    FVector2D& ScreenPosition,
    bool bPlayerViewportRelative
)

Gets the projected world to screen position for a player, then converts it into a widget position, which takes into account any quality scaling.

Public function Static

bool

 

ProjectWorldLocationToWidgetPositionWithDistance

(
    APlayerController* PlayerContr...,
    FVector WorldLocation,
    FVector& ScreenPosition,
    bool bPlayerViewportRelative
)

Convert a World Space 3D position into a 2D Widget Screen Space position, with distance from the camera the Z component.

Public function Static

void

 

RemoveAllWidgets

(
    UObject* WorldContextObject
)

Removes all widgets from the viewport.

Public function Static

UBorderSlot ...

 

SlotAsBorderSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Border Slot, allowing you to manipulate layout information.

Public function Static

UCanvasPanel...

 

SlotAsCanvasSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Canvas Slot, allowing you to manipulate layout information.

Public function Static

UGridSlot &#...

 

SlotAsGridSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Grid Slot, allowing you to manipulate layout information.

Public function Static

UHorizontalB...

 

SlotAsHorizontalBoxSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Horizontal Box Slot, allowing you to manipulate its information.

Public function Static

UOverlaySlot...

 

SlotAsOverlaySlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Overlay Slot, allowing you to manipulate layout information.

Public function Static

USafeZoneSlo...

 

SlotAsSafeBoxSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Safe Box Slot, allowing you to manipulate its information.

Public function Static

UScaleBoxSlo...

 

SlotAsScaleBoxSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Scale Box Slot, allowing you to manipulate its information.

Public function Static

UScrollBoxSl...

 

SlotAsScrollBoxSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Scroll Box Slot, allowing you to manipulate its information.

Public function Static

USizeBoxSlot...

 

SlotAsSizeBoxSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Size Box Slot, allowing you to manipulate its information.

Public function Static

UUniformGrid...

 

SlotAsUniformGridSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Uniform Grid Slot, allowing you to manipulate layout information.

Public function Static

UVerticalBox...

 

SlotAsVerticalBoxSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Vertical Box Slot, allowing you to manipulate its information.

Public function Static

UWidgetSwitc...

 

SlotAsWidgetSwitcherSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Widget Switcher Slot, allowing you to manipulate its information.

Public function Static

UWrapBoxSlot...

 

SlotAsWrapBoxSlot

(
    UWidget* Widget
)

Gets the slot object on the child widget as a Wrap Box Slot, allowing you to manipulate its information.

Deprecated Functions

Name Description

Public function Static

bool

 

GetMousePositionScaledByDPI

(
    APlayerController* Player,
    float& LocationX,
    float& LocationY
)

Use GetMousePositionOnViewport() instead. Optionally and for more options, you can use GetViewportWidgetGeometry and GetPlayerScreenWidgetGeometry are newly introduced to give you the geometry of the viewport and the player screen for widgets to help convert between spaces.