Override Widget properties via Blueprints

Hello,

I’m having a bit of troubles trying to override the properties of a Widget that is component of another Blueprint.

The use case I’m referring to is the following:

  1. Create a Blueprint (“MyBlueprint”)
  2. Add a Widget as Component (“MyComponent”)
  3. Create a Widget (“MyWidget”) with just a Canvas and an Editable Text
  4. Set “MyWidget” as class of “MyComponent”
  5. In the Construction Script of “MyBlueprint”, override the text of the widget as follows:

After Blueprint compilation, something weird happens: the Blueprint editor shows the correct text (the one set in the variable), while in the scene the text is still the default (set in the UMG editor).

If I move the actor around triggering the Construction Script, the text becomes correct in the scene too. But, if I recompile or change any default value of the Blueprint (not just the text variable), the text reverts back to the Widget default.

I checked that the Construction Script is actually called even when the displayed text has been reverted to default, but it’s like the text override gets ignored/discarded. I’ve got the idea that the Construction Script manipulates a Widget instance that later gets replaced by a new one (are Widget mutable at all?), but I might be wrong.

Can someone please tell me what am I doing wrong? Thank you.

Hello Jacopo,

I was able to reproduce your issue and have logged a bug report for it here:

You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Guessing this is still outstanding…as I just wrote the same code and still doesnt update…??

OK…frustration aside I think I have managed to make something work…

Instead of using Construction…just do it on the Event Begin Play…this forces it to run on the first time

Seems to work !!!

Yes, but that way you can’t run the code at editor time - which was what we were trying to achieve. I actually didn’t manage to solve this issue anyway: just had to get around it for time constraints.