RealDocs

USlateBlueprintLibrary::ScreenToWidgetAbsolute

function UMG Blueprint Since 4.7
#include "Blueprint/SlateBlueprintLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Converts a screen-pixel position into absolute Slate application coordinates without knowing the target widget's geometry. Use this as an intermediate step when you need absolute coordinates to feed into AbsoluteToLocal or AbsoluteToViewport.

Caveats & Gotchas

  • The Blueprint display name is 'ScreenToAbsolute'. The C++ function name and Blueprint node name differ.
  • Absolute Slate coordinates are not the same as viewport pixel coordinates — do not pass the output directly to DeprojectScreenToWorld. Use ScreenToViewport or LocalToViewport for that.
  • Like ScreenToWidgetLocal, bIncludeWindowPosition=false is correct only in fullscreen. Always pass true when running in a moveable window.

Signature

static UMG_API void ScreenToWidgetAbsolute(const UObject* WorldContextObject, FVector2D ScreenPosition, FVector2D& AbsoluteCoordinate, bool bIncludeWindowPosition = false)

Parameters

Name Type Description Default
WorldContextObject const UObject* World context for viewport resolution.
ScreenPosition FVector2D Position in screen pixels.
AbsoluteCoordinate FVector2D& Output: the screen position converted into absolute Slate application coordinates.
bIncludeWindowPosition bool When true, subtracts the game window's desktop offset before conversion. Set to true in windowed mode. false

Return Type

void

Example

Convert screen coords to absolute then to a specific widget's local space C++
FVector2D AbsCoord;
USlateBlueprintLibrary::ScreenToWidgetAbsolute(GetWorld(), ScreenPos, AbsCoord, true);
FVector2D LocalCoord = USlateBlueprintLibrary::AbsoluteToLocal(TargetGeometry, AbsCoord);

Version History

Introduced in: 4.7

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.