RealDocs

USizeBox

class UMG Blueprint Since 4.5
#include "Components/SizeBox.h"

Description

A single-child wrapper that overrides or constrains the desired size reported by its child widget. Use it to force a fixed width/height or clamp the child's size within min/max bounds.

Caveats & Gotchas

  • WidthOverride and HeightOverride completely ignore the child's desired size on that axis. Use SetMinDesiredWidth/SetMaxDesiredWidth to constrain without fully overriding.
  • Size overrides only affect the desired size reported up to the parent layout pass. If the parent ignores desired size (e.g. a Canvas slot with a fixed size), USizeBox has no visible effect.
  • ClearWidthOverride() and ClearHeightOverride() restore the child's natural desired size on those axes.

Example

Force a button to a fixed size C++
MySizeBox->SetWidthOverride(200.f);
MySizeBox->SetHeightOverride(40.f);

Version History

Introduced in: 4.5

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.