RealDocs

UBorder::SetBrush

function UMG Blueprint Since 4.0
#include "Components/Border.h"
Access: public Specifiers: UFUNCTIONBlueprintCallable

Description

Replaces the border's entire background brush with a new FSlateBrush, overriding the image, tiling, and margin settings in one call.

Caveats & Gotchas

  • Overwrites the whole Background struct, including its own tint color — any tint previously applied via SetBrushColor is replaced by the new brush's TintColor.
  • For simply swapping the texture or material while keeping existing tiling/margin settings, SetBrushFromTexture or SetBrushFromMaterial is less error-prone.

Signature

UMG_API void SetBrush(const FSlateBrush& InBrush)

Parameters

Name Type Description Default
InBrush const FSlateBrush& Full brush definition (image, tiling, margins, tint) to use as the border's background.

Return Type

void

Example

Replace the background brush C++
void UMyUserWidget::ApplyPanelBrush()
{
    FSlateBrush NewBrush;
    NewBrush.DrawAs = ESlateBrushDrawType::Box;
    NewBrush.Margin = FMargin(0.25f);
    NewBrush.TintColor = FSlateColor(FLinearColor::White);
    if (MyBorder)
    {
        MyBorder->SetBrush(NewBrush);
    }
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.