Why do UMG widgets have a Preconstruct/Construct instead of Construct/BeginPlay like Blueprints?

I’m trying to understand why UMG widgets have a Preconstruct/Construct instead of Construct/BeginPlay like Blueprints. It seems like they do the same thing, but have different names. Why the distinction?

Because they are very different from the Actor’s Construct/BeginPlay functions. Construct is called right before the widget is first drawn on the viewport for the first time. If you remove a widget from the viewport and then re-add it, Construct will be called again. Unlike Actor’s Constructor, widget’s Construct is only called during play and never in the editor.

PreConstruct is a somewhat recent thing. It was added in 4.16 or 4.17, I don’t remember exactly which. It’s always called before Construct and unlike that one it is called on the editor (there’s even a parameter called “InDesignTime” that you can use to detect this). It’s purpose is to enable the creation of WYSIWYG widgets that can change their visuals during editing time based on the Widget’s properties. For example, you can use it to create custom button widgets that already contain a label text and be able to preview that text in other widgets that use it.

7 Likes

I feel like this doesn’t answer the question. A widgets construct is very different than an actors construction, yes, but its very similar to BeginPlay, and PreConstruct is very similar to Construction.

So why not just name them the same things for simplicity, there’s no meaningful difference I’ve noticed.