What happened to the ChangeMenuWidget node

On the bottom part of this page it mentions a ChangeMenuWidget node but this seems to be missing from 4.20 How do I now change to a new widget when I press on an option. I don’t want tabs I want a new window and Its a 3d widget also.

Look like a custom function node that removes a widget from the viewport, clears its variable (so the GC can pick it up), creates a new widget, stores it in a reference and adds it to the viewport.

There’s no catch here.

I don’t have a viewport its a 3d widget. Add to viewport puts it in the center of the screen

You do have a viewport, everybody does ;). Add to viewport does not do anything to the widget’s location, these are the anchors, offsets, parent hierarchy, canvas position, that control widget screen space; you have full control over them and you can also directly set viewport position.

If you want to use a 3d widget instead:

  • create a 2d widget
  • add a widget component to the actor that will control it
  • assign the above-mentioned 2d widget class to that component
  • moving component moves the widget (moving the embedded 2d widget will also move the widget, but in relative space)

If you want to effortlessly swap the embedded widgets often, do so in a macro.

Ya I can do a 3d widget place it in the world click on it, have it do things but the only thing I can’t do is have it switch to another window. You mention using a macro, are there any tutorials that go over that?

I just tested it and you can swap widgets around in a widget component just fine. Widget Component -> Set Widget. That’s it, it’s literally one node. Is there anything particular that should work but it does not?

Macro tutorial? Macro is what you put inside:…erGuide/Macros

Macro for a widget component swap out would look like this:


This will essentially replace one widget with another in the same component.

eidt: It’s even easier if you spawn widgets before hand, keep them hidden and replace the widget components loadout using a stored reference - this is actually a path that I’d take. You won’t have to worry about saving data in the widgets that get replaced. That’s, of course, providing it’s desirable.

Ok I don’t think I explained myself properly. So in the main widget I have a picture of an item. Then I have put a button over that item and in the widget graph I chose the onclick event and what I’m trying to do is when you click on that button in the widget it will change the 3d widget to another widget. Is that possible?

This might explain it better

Yes, drag a wire from the Widget Component > Get User Widget > Cast To (wWindowBrowser) > Get Image > Get Brush > Set Members in SlateBrush > expose Image pin on the node

Ok I think I’m almost there. Thanks for all your help so far. I’ve included what I can follow so far in the pic below I’m just unsure about a few things. When you say Get Image do you mean? The image that is in the other widget? because that was just an example the widget I’m trying to load has multiple images of items I want to click on and I guess because I don’t know what image you mean I’m usure of what you mean by get brush and slatebrush do you mean the node called get brush in the second pic I uploaded? Also when I search for slatebrush a lot of options come back.

A reference of the image you want to change. The clicked image I presume - I do not know how your system is supposed to work so I must assume certain things.

Normally, if you wanted to update a widget component’s image from the outside, you’d do this:

Judging by what you said above, your situation is different, though. You’ll be updating it from the inside, by clicking on the image that needs changing, right? How does the user chooses which images appears in the clicked slot? You will need to *pull *the correct image from somewhere.

so I’m not trying to change the image but change the widget. The image that seems to appear in the slot is actually a new widget with that image already in there. So it goes like this. Widget 1 has 3 images a cup a ball and a brick. The user will click on the image of the ball which will then load up widget number 2 which has images of 5 different balls and each of them would select a new widget. I want to do this in the 1st widget itself. So I put a button over the cup another button on the brick and one last one over the ball. Then I will go into the graph for the widget. Select the button for the ball. Click onClicked for that button and from there load up a whole new widget. Is this possible?

@Everynone Do you understand what I’m trying to do? I’m not sure if I’ve explained it properly.

So you want to replace the button + image with another widget? Kind of tricky.

The main problem is that your wrap box does not contain user widgets - you used a button + image. Those 2 should be wrapped in a separate widget - rather then replacing them with a new widget, you could update the existing widget. You can still do it with your setup but do not insist on replacing the wrap box’ slot with another button+image or another widget. The reason is below.

You cannot insert objects into UMG panels the way you insert data into arrays, you can only add at the end. If you wanted to exchange image 4 out 10, you would have to clear the panel first and then repopulate the whole thing. This also requires extra sorting and keeping track of the indexes - it’s not particularly difficult, but it’s annoying.

My advice here would be to wrap the button + image combo into a separate widget and populate the wrap box with those. The user widget can then have an onClick event that pulls an image out of whenever you want and update itself. [HR][/HR]This is all *assuming *(again) that every widget in the wrap box is of the same class.

Ahh I can see where the misunderstanding is coming from. I’m not trying to replace the image and button with another widget. I’m trying to replace the widget with another widget. The button would just fire that event. I want it to switch it to a whole new widget entirely is that possible?

@Everynone if that’s still unclear then I think this is the best way I can explain it. So do you know how you can open up a 3D widget blueprint and in the viewport you choose which widget goes in there and if you want you can click to see the drop down list and select another widget and put it into the 3D widget. How would I do that during the game using blueprints? Switching widgets in a 3D widgets.

That makes sense, yeah, but I’m not sure why you insist on switching widgets around unless you must have a different widget class in every wrap box slot. Doing the indexing would make it unnecessarily complicated. If you must have a *different widget class in *every slot and replace them with something completely else without repopulating the panel, then you’d need to rely on something like a *named slot - *think of it as a socket that stuff can be added to and removed from.

Is there a reason why you cannot just update the existing widget in the wrapbox slot and need to push a brand new widget in? Like a specific design choice?

I can try to put something together later on as a demonstration.

The main reason would be because this will be a very large menu system. It’s a gun system so the 1st menu would allow me to select if it’s a shotgun or hand gun. If I select a shotgun then the next widget will have 4 types of shoguns like bolt action front loading and so on. Then if I select a bolt action the next widget would have about 10 different guns I can select. Then the next widget will show a gun that I can click on which would spawn in the game world. Each widget would have a back button and as far as I know you can only have clickable buttons in the widget itself so I don’t know how you could do that any other way.

@Everynone Hi I think I’m really close but I’m stuck on the last bit. I have an example of a menu where if you click on a menu button it brings you to a new widget. Its very simple and it works. Exactly what I want to do but it uses and add to viewport which doesn’t work with 3d widgets. If you want to add to a 3d widget you need to use set widget instead of add to viewport but the problem is you have to tell the widget to add it into the widget component I’m using a ref to the widget component and putting that into a cast to the 3d widget blueprint but I can’t for the life of me figure out what to put into the cast to object. Can you take a look at the pictures below and tell me what I’m missing?

In the second pic you’re pulling Widget Displayed out of an invalid cast node.

Is this the behaviour you’re looking for: