UMG, auto scaling

Hello,
I have this widget:

275479-screenshot-1.png

275480-screenshot-2.png

and It contains Ability Item widget, which is ready to drag & drop, but when I drag every item out of the grid panel, the widget scale down. Like this:

275501-screenshot-3.png

275502-screenshot-4.png

275503-screenshot-5.png

So… does UMG contain something like: keep size, Auto-scale off,…?

Thank you so much for answers.

tl;dr - wrap it with a size box


The real answer depends on where this widget ends up at.

Every time a widget ends up in a a container, that container creates a slot for the child. A vertical box creates a different slot type than a canvas, some slots have additional properties - for example the grid has rows and columns, something a vertical box lacks.

  • If you drop a widget directly into the viewport - you can Set Desired Size in Viewport and the widget will respect that.
  • If you drop it onto a canvas - you can Set Size and / or even enable Size To Content - {also called Get / Set Autosize but the name was never updated}

However, most containers do not offer setting size explicitly but offer alignment options - Fill, Centre, Bottom and so on. This can be augmented by padding the slot from any side in order to reach the desired position / size.


If you do not want to manually Set Size every time or worry what container the widget ends up in, you can wrap the widget with a SizeBox and override its dimensions. In this case the SizeBox will try to maintain the widget size unless its direct parent is too small to fit it or has alignment rules that override the behaviour - like Fill.


Essentially, the root widget does not really decide what size it is, it’s a combinations of their own children that try to expand and the root’s own parent trying to contain and tolerate its desired size.

Do note - every time you add another wrapper to a widget, you increase its complexity and, eventually, it will eat into the performance - start worrying when you display hundreds of widgets unless you’re running the game on a mobile potato.

I generally avoid Size Boxes as they complicate resizing and scaling of the user interface (one could argue that the overrides can be enabled / disabled on demand - which is true), but they can be useful when you need to drag it between various parents.

edit: also, consider looking into UserWidgets for reusable functionality - each of your ability should be a self-contained widget that you just add to the grid - there’s no reason to set up dozens of borders and text boxes manually.