UButton
Inherits: UObjectBase › UObjectBaseUtility › UObject › UVisual › UWidget › UPanelWidget › UContentWidget › UButton
#include "Components/Button.h" Description
A clickable container widget that holds a single child widget. Exposes OnClicked, OnPressed, OnReleased, and OnHovered delegates for user interaction.
Signature
class UButton : public UContentWidget Caveats & Gotchas
- • UButton is a ContentWidget — it holds exactly one child. Place other widgets (e.g. UTextBlock, UImage) inside it to create styled buttons.
- • Direct property access for WidgetStyle, ColorAndOpacity, and BackgroundColor was deprecated in UE 5.2. Use the getter/setter functions.
- • Keyboard/gamepad focus navigation is enabled by default (IsFocusable). Set to false for mouse-only buttons in menus that don't need controller support.
Example
Bind a click event in C++ C++
// In NativeConstruct:
MyButton->OnClicked.AddDynamic(this, &UMyWidget::OnMyButtonClicked);
// Handler:
void UMyWidget::OnMyButtonClicked()
{
// handle click
} See Also
Version History
Introduced in: 4.5
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?