Do you have any tips for working inside widgets?

At times it feels like the twilight zone to me, just mysterious things going on. Any kinks or quarks you know about widgets?

Like can they be permanently destroyed? Something greater than remove from parent or set visibility?

1 Like

For me personally, the main rule is to NEVER* add logic to a widget that in any way affects external objects.
A widget must have a control object or actor from which it renders data.
The widget only needs to transform the input data into its visual.
Or communicate using delegates that he wants to change something, but not change anything directly.

*except for utility widgets that exist only in the editor.

2 Likes

pfff, UMG is mostly quirks. Fair enough.

Like can they be permanently destroyed?

Yes, dereference it - nullify any refs and remove from parent. The Garbage Collection will scoop it up after 60s (by default); one can Collect Garbage themselves:


remove from parent or set visibility

If you Remove from parent and want to bring the same widget back, you will need to Add it to a container ==> this will trigger the Construct event and can override whatever changes were made to the widget. Changing Visibility does not do that.


Some good reading:

Another one:

https://dev.epicgames.com/community/learning/knowledge-base/VZZD/unreal-engine-slate-general-optimization-guidelines

And something that ties with what @PREDALIEN mentioned:

In short, the UI’s job is to show stuff - don’t make it do more than that. Adapt Event Driven approach whenever possible.

1 Like

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