UButton::SetStyle
#include "Components/Button.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Replaces the button's entire visual style, including its per-state brushes and click/hover sounds.
Caveats & Gotchas
- • Overwrites the whole FButtonStyle at once — if you only want to tweak one color, use SetColorAndOpacity or SetBackgroundColor instead of round-tripping through GetStyle/SetStyle.
- • Takes effect immediately but only visibly updates once the underlying Slate button is rebuilt or repainted, which normally happens on the next frame.
Signature
UFUNCTION(BlueprintCallable, Category="Button|Appearance")
UMG_API void SetStyle(const FButtonStyle& InStyle); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InStyle | const FButtonStyle& | The full button style (normal/hovered/pressed/disabled brushes, sounds, etc.) to apply. | — |
Return Type
void Example
Apply a custom style at runtime C++
FButtonStyle CustomStyle = MyButton->GetStyle();
CustomStyle.Normal.TintColor = FLinearColor::Red;
MyButton->SetStyle(CustomStyle); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?