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.
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.
Signature
class UButton : public UContentWidget Example
Bind a click event in C++ C++
// In NativeConstruct:
MyButton->OnClicked.AddDynamic(this, &UMyWidget::OnMyButtonClicked);
// Handler:
void UMyWidget::OnMyButtonClicked()
{
// handle click
} Functions (15)
Appearance 6 ▼
| Access | Type | Name |
|---|---|---|
| public | function | UButton::GetBackgroundColor |
| public | function | UButton::GetColorAndOpacity |
| public | function | UButton::SetBackgroundColor |
| public | function | UButton::SetColorAndOpacity |
| public | function | UButton::GetStyle |
| public | function | UButton::SetStyle |
Interaction 9 ▼
| Access | Type | Name |
|---|---|---|
| public | function | UButton::GetIsFocusable |
| public | function | UButton::IsPressed |
| public | function | UButton::GetClickMethod |
| public | function | UButton::GetPressMethod |
| public | function | UButton::GetTouchMethod |
| public | function | UButton::SetAllowDragDrop |
| public | function | UButton::SetClickMethod |
| public | function | UButton::SetPressMethod |
| public | function | UButton::SetTouchMethod |
Properties
| Access | Type | Name |
|---|---|---|
| public | property | UButton::OnClicked |
| public | property | UButton::OnHovered |
| public | property | UButton::OnPressed |
| public | property | UButton::OnReleased |
| public | property | UButton::OnUnhovered |
See Also
Version History
Introduced in: 4.5
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?