USlateBlueprintLibrary::LocalToAbsolute
#include "Blueprint/SlateBlueprintLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Transforms a point from a widget's local space into absolute Slate space using the widget's accumulated render transform. This is the Blueprint-accessible wrapper around FGeometry::LocalToAbsolute.
Caveats & Gotchas
- • Returns coordinates in Slate's absolute space, which is window-relative in most in-game contexts. To obtain viewport pixel coordinates for use with DeprojectScreenToWorld or line traces, pass the result through LocalToViewport instead.
- • Requires the geometry to be fully up-to-date; calling this during PreConstruct or before the first layout pass may return zero or stale results.
Signature
static UMG_API FVector2D LocalToAbsolute(const FGeometry& Geometry, FVector2D LocalCoordinate) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Geometry | const FGeometry& | The geometry of the widget whose local space you are converting from. Obtain via GetCachedGeometry() or event parameters. | — |
| LocalCoordinate | FVector2D | Point in the widget's local space, where (0,0) is the top-left corner. | — |
Return Type
FVector2D Example
Blueprint: convert widget top-left corner to absolute space C++
// C++ equivalent of the Blueprint node:
FVector2D AbsPos = USlateBlueprintLibrary::LocalToAbsolute(
MyWidget->GetCachedGeometry(),
FVector2D::ZeroVector // top-left of the widget
); See Also
Version History
Introduced in: 4.7
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?