UButton

The button is a click-able primitive widget to enable basic interaction, you can place any other widget inside a button to make a more complex and interesting click-able element in your UI.

Windows
MacOS
Linux

Inheritance Hierarchy

Syntax

class UButton : public UContentWidget

Remarks

The button is a click-able primitive widget to enable basic interaction, you can place any other widget inside a button to make a more complex and interesting click-able element in your UI.

  • Single Child

  • Clickable

Variables

Name Description

Public variable

FLinearColor

 

BackgroundColor

The color multiplier for the button background

Public variable

TEnumAsByte< EB...

 

ClickMethod

The type of mouse action required by the user to trigger the buttons 'Click'

Public variable

FLinearColor

 

ColorAndOpacity

The color multiplier for the button content

Public variable

bool

 

IsFocusable

Sometimes a button should only be mouse-clickable and never keyboard focusable.

Protected variable

TSharedPtr< SBu...

 

MyButton

Cached pointer to the underlying slate button owned by this UWidget

Public variable

FOnButtonClicke...

 

OnClicked

Called when the button is clicked

Public variable

FOnButtonHoverE...

 

OnHovered

Public variable

FOnButtonPresse...

 

OnPressed

Called when the button is pressed

Public variable

FOnButtonReleas...

 

OnReleased

Called when the button is released

Public variable

FOnButtonHoverE...

 

OnUnhovered

Public variable

TEnumAsByte< EB...

 

PressMethod

The type of keyboard/gamepad button press action required by the user to trigger the buttons 'Click'

Public variable

TEnumAsByte< EB...

 

TouchMethod

The type of touch action required by the user to trigger the buttons 'Click'

Public variable

FButtonStyle

 

WidgetStyle

The button style used at runtime

Constructors

Name Description

Public function

UButton

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Const

bool

 

IsPressed()

Returns true if the user is actively pressing the button.

Public function

void

 

SetBackgroundColor

(
    FLinearColor InBackgroundColor
)

Sets the color multiplier for the button background

Public function

void

 

SetClickMethod

(
    EButtonClickMethod::Type InClickMet...
)

Public function

void

 

SetColorAndOpacity

(
    FLinearColor InColorAndOpacity
)

Sets the color multiplier for the button content

Public function

void

 

SetPressMethod

(
    EButtonPressMethod::Type InPressMet...
)

Public function

void

 

SetStyle

(
    const FButtonStyle& InStyle
)

Sets the color multiplier for the button background

Public function

void

 

SetTouchMethod

(
    EButtonTouchMethod::Type InTouchMet...
)

Protected function

FReply

 

SlateHandleClicked()

Handle the actual click event from slate and forward it on

Protected function

void

 

SlateHandleHovered()

Protected function

void

 

SlateHandlePressed()

Protected function

void

 

SlateHandleReleased()

Protected function

void

 

SlateHandleUnhovered()

Overridden from UPanelWidget

Name Description

Protected function Virtual Const

UClass *

 

GetSlotClass()

UPanelWidget.

Protected function Virtual

void

 

OnSlotAdded

(
    UPanelSlot* Slot
)

Protected function Virtual

void

 

OnSlotRemoved

(
    UPanelSlot* Slot
)

Overridden from UWidget

Name Description

Public function Virtual

const FText

 

GetPaletteCategory()

Gets the palette category of the widget

Protected function Virtual

TSharedRef< ...

 

RebuildDesignWidget

(
    TSharedRef< SWidget > Content
)

Protected function Virtual

TSharedRef< ...

 

RebuildWidget()

Function implemented by all subclasses of UWidget is called when the underlying SWidget needs to be constructed.

Public function Virtual

void

 

SynchronizeProperties()

Applies all properties to the native widget if possible.

Overridden from UVisual

Name Description

Public function Virtual

void

 

ReleaseSlateResources

(
    bool bReleaseChildren
)

Overridden from UObject

Name Description

Public function Virtual

void

 

PostLoad()

Begin UObject.

Deprecated Variables

Name Description

Public variable

USlateWidgetSty...

 

Style_DEPRECATED

The template style asset, used to seed the mutable instance of the style.

References

Module

UMG

Header

Runtime/UMG/Public/Components/Button.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback