Square Slate SBox not square

I want my button with its image to be a square 64x64 pixel big. But There is som weird border on the sides of the image. (All buttons have the same issue with side margin/border/padding, one of them is sbox 96x96 though)

SNew(SVerticalBox)+ SVerticalBox::Slot()
.Padding(ButtonPadding)
.HAlign(HAlign_Center)
	[
	SNew(SBox)
	.HeightOverride(64)
	.WidthOverride(64)
	.VAlign(VAlign_Fill)
	.HAlign(HAlign_Fill)
	[
		SNew(SButton)
		.VAlign(VAlign_Fill)
		.HAlign(HAlign_Fill)
		.ContentPadding(FMargin(0, 0))
		[
			SNew(SBox)
			.HeightOverride(64)
			.WidthOverride(64)
			.VAlign(VAlign_Fill)
			.HAlign(HAlign_Fill)
			[
			SNew(SBorder)
			.BorderImage(FMenuStyles::Get().GetBrush(TEXT("SB_DoorIcon")))
			.Padding(0)
			]
		]
	]
]

Adding the SBox withing the SBox was my latest attempt. Tried that because I saw that the Widget Reflector added it anyways.

Default button padding looks like so for some unfathomable reason:

image

1 Like

That worked! I added a custom style and now an image or text fill the entire button. Insane that they have it on by default. Could I make a doublet out of SButton (call it SMyFavoriteButton) and then change the preset values to my liking? Or maybe just change the default SButton directly?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.