Widget Blueprint wont communicate with another Widget Blueprint

Hi all,

This is my problem right now,

I’m trying to do a menu with sub-menus, from what I’ve seen, the best way is to use a Widget Switcher.

So I have a “Menu_System” BP inside I have the function with the Set Active Widget Index:


https://forums.unrealengine.com/core/image/gif;base64

Then I have the “MainMenu_UI” BP which is the first thing the user sees, after click in one of the first buttons (Just have those two for testing) it should change the index No. and send you to the correct sub-menu, like this:


So…
Main Menu Index: 0
Collaborative Menu Index: 1
Stations Menu Index: 2

I’m creating both blueprints on my character controller, like this:
21a5de21be15bc1aafdda1c5bc3d8261d0148ed0.jpeg

When I try it out, the button is printing the correct index, but it won’t trigger the event on the Menu_System BP, I tried doing a variable inside the Menu_System BP and using that one to change the Index, but it didn’t work either, so I though of adding an input to the function, but its not even triggering the function.

I’m sure I’m missing something, I also tried to add an interface to the System BP, and add a switch function, but it didn’t work either… I’m somewhat new at this, so I know there is something I’m missing I just can’t figure out what it is.

Thank you in advance!
Best Regards!

When you load up your widgets, they are instances of a base widget bp. You would have to make them see each other.
The easiest way, by far, is to have the widgets declare themselves to the controller OR to have the controller manage each widget’s identity.

So when you open widget 1, on construct, it finds the player controller and sets a specific variable to itself.
When you open widget 2, if it needs to access widget 1, it will go through the controller to see it as the variable.

Hi Galvanicus, thank you for the quick response…

So if I understood correctly, it mens I have to call the controller inside the Widget BP, or reference the Controller BP that is holding a variable with the Widget Blueprints, correct? If I already created the Widgets on the Controller (as in the picture on the first post) then I would only need to call the Controller BP, get the variable (as Get) and pull the function from there? Note: even though in my mind there is no reason why it wouldn’t work, it didn’t lol

But what I did instead was to Get Player Controller –> Cast it –> Target the “System Menu Ref” BP –> call the function needed, it worked. Thank you very much!!
So this is what I have now:

My only question now is, isn’t casting a very expensive option? considering I would have several menus casting (Not just the one), is there any other way of going at it? in the long run the idea is to have it working on an iPad, so I’m trying to do it as efficient as possible right now so its not as heavy on the iPad.

On the side, I had the idea that you could create a “Widget Blueprint Child” but I think I’m going crazy because I can’t seem to find any info about it, and I’m not being able to do it… lol

Thank you again for your help!
Best Regards!

Ok,

So I ran into another problem…

So I’m adding to viewport the Menu_System BP so that one can activate all the other submenus. My problem shows up when I call one of the submenus… Now the buttons won’t work… Unless is for changing the index like on the image above… they just won’t work… I have to “Add to Viewport” that BP for them to work correctly, but by doing that, I can’t work with the Switcher…

At this point I’m honestly wondering if the Switcher has any purpose at all… Everything would work correctly if I Remove from Parent → Add to Viewport for every button that changes a menu, I though this tool was going to be more efficient than that, unless I’m missing something that is…

If you know of a solution where I can use the Switcher, please let me know.

Thank you in advance,
Best Regards!

No idea on that one; that’s all you :stuck_out_tongue:

Sure it is, but you don’t have any other way to do it. Performance can be improved in other ways than avoiding casting.

Ok, so in case anybody runs through the same problem as I did.

I manage to use the Switcher and get the buttons working, my problem was when I tried to switch BPs with the Switcher, right now I’m using it only in one BP, and it goes through different “boxes” each with the buttons I want. That way I don’t have to cast, the only problem I’m going to run into probably, is when I add the whole collection of meshes… it’ll be too big I think, and I’m not sure how I’m going to tackle that.

In the meantime, for the Switcher, seem to be better if you stay within the same BP!

Best Regards.

hello :C I do not know how to explain myself. I am going to summarize the checkpoints. They work perfectly for me at level 1. Map 1 on map 2. They are not saved when I leave the game and I go back inside help

Thats why, i never use widgets, to communicate between each other… i rather prefer to create an actor BP controlling them or better, main player… but widgets and blueprints never save anything, they keep the data during the play in a level, then loose everything, not any BP at all has persistence (watch this: HTF do I? Save Variables between Maps ( UE4 ) - YouTube), if you change from one map to the other, they will lose everything since they have to construct again when you load another map… for that reason, you need to use Game Instances, its the only BP that is alive from the moment you start your game till you quit, it can store variables between maps, characters and widgets cant

This is the hardest in games, storing data, thats why you need to plan better before start the project, in this case each Widget has to store the data inside variables at Game Instances, so when you load the new map, each of those BP that require the data on “event begin play” the first thing they do is get that data from Game Instances and apply, bassicaly before storing anything to main player, first… you need to store this into GameInstances (for changing between levels), then store it to player (for current play)

After you quit, and exit, Game Instances also lose all the data, unless you use SaveGame to store it, from Game Instances, then make GInstances to restore it when you “load” a game, or load it automaticaly on event begin play if it is a graphic, settings data, each time you start the game, this seems complicated, but it is not, after you practice,

the big issue is to find out, wich data you should not save, i just finished my first project and i only save about 5 variables: coins (collectables), current mission, weapons collected, loot, ammo, things like this, because if you try to save everything… its months of work and it can cause lots of bugs… for things like, settings, buttons, i create a default gamesave file, and when the game starts, menu restores settings from savegame.

This tutorial is excellent for understanding this logic between maps: [TUTORIAL] PERSISTENCE in Unreal Engine 4 [Eng] - YouTube

then, making a menu for save/load, delete load, … thats more advanced and you need to understand first the savegame GInstances logic, the hardest part i found was buttons for PC and Controller… omg, that was weeks of work, because each little change has to go to a save, have custom values, restore them to default or save customs, make text to show changes as text and recognize restored data… wow… hard work

The simpler the save, the better.

I just started working on my Save/Load options for my APP… and its been a trip, you actually explained it pretty well and I got some ideas straighten out reading it… Right now I have two problems though:

My app is a layout that you can populate with things, so the idea is for you to add thing move them around and then save it, and you can load it back when you go back into the app… but I’m having trouble deleting things.

Ex. If I add a couch, I collect the Actor, Class and Transformation info in separate variables, and add them to an array… from that array I extract those values and add them to the SaveGame, which when asked to load extracts those values from the SaveGame and copies them into the game thats running…
But, I think its better if somehow (that my problem, figuring out how to) I can Appoint an Index No. to each Actor placed on the Level, that Index No. contains a profile with all the info (transform, class, actor, and more if needed at some point) and then when I delete something I can just look for the Index No. and delete that index from the array (deleting everything that has to do with it). Maybe later on add a “compare” what is different and act based on that, I think that would allow me to overwrite continuously and maybe later on apply an automated save.

Is it possible? anyone has done it or has a solution like it?

Thanks in advance!

Best Regards!