User created Widget, expose on spawn/construct?

When including a “User created Widget”, how can I set a variable at its “Construct” from the parent? Like Expose on Spawn.

Mark the variable as both Instance Editable and Expose on Spawn (see image), compile, and any nodes creating this widget should now have that variable exposed as a pin (see image).

I’ve tried that but it won’t work. Also, it is a User Created Widget included in the canvas not the way you have shown.

In that case, just set Instance Editable, compile both blueprints, and the variable should show in the details panel once you select the child widget. (see top right on the image)

This is the compllication I’m having … the variable is editable but I’m not setting it in the Designer I’m wanting to do it by Construct in the BP because it tells the widget what to load. (hope that makes sense)

How about this?

Would be a lot easier to help you if I had some screenshots and/or additional context on what exactly you’re trying to do btw. :stuck_out_tongue:

Thanks yeh it is the right way. I don’t know if it’s a bug so I tried settig it up blind so to speak and can only tell that it’s working at runtime.

1 Like

I’m sure this has to be a bug, after rearranging some things it’s now not working.

Can you provide some screenshots? Screenshot everything you have and I might be able to help, just saying “something isn’t working” isn’t actually a clue. :stuck_out_tongue:

This is very true, sorry.

From the parent BP …

Owning Widget …

Widget …

Thanks for the screenshots.

What’s the expected result and what is the result you’re getting? Can you screenshot how this looks in game too?

Not much to show …

And this isn’t the expected result I assume? What is supposed to happen?

(as you can see I have no context of what you’re working on, it’s hard to know what went wrong without details on what “wrong” means)

Are you a bot?

Your questions are not very precise so I’m struggling to help, and that makes me a bot?

I repeatedly asked for specifics and you attached a screenshot with 2 buttons that seemingly look fine, how am I supposed to know if that’s the expected outcome or not? :smiley:

Very true.

The desired outcome is to show a button or keep it hidden if a variable is true or false when the widget is constructed. The widget is included in the main canvas, it is not created in the main blueprint. I have exposed the variable in the widget so it can be set by the parent widget but it’s not setting it at the construct stage.

(checkbox is true)


(variable set on subwidget)

(variable checked in subwidget, showing the Resume button)

(the Resume button is visible, the Reload button isn’t)

Based on these 4 images, you propagated Is Pause to your button visibility logic and set the Resume button to visible, and that’s what the last image shows (a big “Resume” button). I don’t get why you think the variable isn’t being set, the entire sequence clearly works… What am I missing here?

Just a slight correction…

The first image is not a Widget, it’s the Blueprint that creates and shows all of the widgets. It also shows where “IsPause” is being set from.

The second image is of the main Widget with the canvas that includes the sub Widget called “Widget Menu Pause Buttons” and shows the “IsPause” being set from the main widget to an exposed variable in the sub widget.

The third image shows the logic. If “IsPause” is true then show “Button Resume” and if false then show “Button Reload”. This is being done at the Construct phase.

The 4th image is when the variable is set to “true” then it shows “Resume” but if it’s set to “false” it still shows “Resume” and not “Reload”.

Ah, this is the part I was missing.

Are your buttons invisible by default (“Collapsed” is probably most appropriate)? Because you’re not explicitly hiding the other button in the 4th image, so if they’re not invisible by default that might be the issue. If so, either set them both to be invisible by default, or add SetVisibility nodes to the 4th image to set the “other” button invisible (Resume Visible => Reload Collapsed; Reload Visible => Resume Collapsed).

Yes, they are both “Collapsed” to start with. It’s just not setting the variable to choose which remains invisible.