UWidget::GetCachedGeometry
#include "Components/Widget.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Returns the geometry from the last time this widget was ticked. Contains the widget's position, size, and transform in both local and absolute space.
Caveats & Gotchas
- • The geometry is one frame stale — it reflects the previous frame's layout. Never use this during a widget's construction; the geometry will be a default-constructed zero-size value.
- • Epic explicitly recommends avoiding this function when possible. Prefer making layout-dependent widgets part of the hierarchy so Slate resolves dependencies in a single pass.
- • The returned reference is to internal storage. Do not hold onto it across frames; copy the FGeometry if you need it to survive beyond the current call stack.
Signature
UMG_API const FGeometry& GetCachedGeometry() const Return Type
const FGeometry& Example
Check if an absolute screen position is inside a widget C++
FGeometry Geo = MyWidget->GetCachedGeometry();
bool bInside = USlateBlueprintLibrary::IsUnderLocation(Geo, AbsoluteMousePos); See Also
Tags
Version History
Introduced in: 4.10
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?