UMG, auto scaling
Hello, I have this widget:
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:
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.
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here