How do I unlock a button when a player collides to a box through different levels?

I just want to bind a button to make it so when I get into a collision box, it activates a button through another level. I tried to work it out, using references and boolean expressions, but it cant work. I also used casting nodes, still didnt work.

When you say level, do you mean in a different map, such that to get there you need to use the ‘Open Level’ node? or is it just somewhere else in the same map as the collision box?

It’s a separate map. For now, I got 2 which is: MainMenu, and Level30. My player when it overlaps a collision that is from an actor collision on Level30, I want to have a button on a widget that only opens in MainMenu or activate/enable. I tried to use different ways to bind, and I also tried the visibility bind beside the enabled binding. For some reason, the actions on everything work, except for the button to be visible, or enabled in a widget through another level. Do you think a load level in a background kind of thing would work?

If i’m understanding correctly I believe for what your talking about you will need to store your variable information in the Game Instance so it can record it before one level is unloaded, and pass it to the new level after it loads and then passed to the new version of the widget. The Game Instance is a singleton class which basically means at the beginning the .exe starts up, there exists only one unique version of this blueprint. until you close the game its the same one the whole time. the Game Mode exists for the duration of the current level, so any information stored there is lost when the level is changed. This includes any widgets, actors, anything you may have had the game mode add to the players viewport if it came from any blueprint other than the game instance blueprint.

This is a pretty decent tutorial to understand how to create your own custom game instance so you can pass information back and forth from it: https://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/

Thanks so much for giving me a better understanding for the uses of “Game Instances” but I was more into something like a save. The thing is that my main menu widget is at another level. And to be clear there a button that is invisible on one level, and i want to make it visible through another level. I assume its using the “Bind”. I’ve tried but i’m not sure why it’s not executing when I set it visible using a variable through a player blueprint on another level.

What I tried was using a variable and setting it to visible, and I set a bind on the button that cast from the player blueprint and get that value that was set it to visible and its suppose to turn the button visible, but it doesn’t, it just stays at its default value.

If your talking about this bind, then I’m not 100%.

313850-bind.png

I really tend to use the Is Variable setting to allow for custom event triggers in the graph:

313862-graph.png

Regardless, you may want to check your bind function is being called once the level loads. when you load the new level unless its called again, everything will be at default because its a new instance of that widget.

Oh, well I still can’t get a solution, but ill try to use your answers and see what I can do, thanks

If you can share a snippet of the logic used to initialize the widget when your loading the levels, both menu and level one, might be able to point out the problem.

So 3 things, 1. Button properties which are the level selector button in the main menu, 2. The level selector button “Bind Function”, and 3. The player blueprint. My system I tried to make is basically I have a box that when the player passes the finish platform, it sets the boolean to true which the button on the widget gets.

So my guess is your widget is acting weird because of the cast your attempting inside it. Try simplifying it to a stored bool variable that you update the value off when you load the widget in each level, or change it in a single level. Here is an example setup of some text color change, and the button enable/disable as bind events. along with how i’m updating them in the blueprint that creates them.

314064-button.png

314065-color.png

314067-bind.gif

So I tried to use what you did but just a little different, I get errors when I exit out of PIE and the button only activate on the default value set by a boolean in the widget. So I tried when it’s true, the button goes enabled, but when false, it stays disabled. So here the image shows it cant read one of the nodes or something. I also tried to use a separate variable to set the boolean to true, and with or without it still doesn’t work.

Based on the error and what is showing, the reference node to Main Menu Widget is invalid. so the error is in Base_BP. were are you setting the reference for that in that BP?

The Main Menu widget reference is when I created a new variable, and searched up the main menu and found the widget. If you say its invalid, meaning it probably can’t find it, then that means the level is not loaded or the widget isn’t on which is not actually on at the time its supposed to activate a button. I’m not sure if that makes sense.

I’ve managed to get away based on what you said, I believe you mentioned about the save game and I’ve posted another answer besides yours, and those screenshots show how it’s done, I appreciate your time and thank you!

Seems like doing a save to activate is what made it to work instead of activating then trying to save which activating didn’t work anyways. The save game object was basically doing both at once and transferring data to activate/enable the button through the other level.

I’m Glad it worked out! good luck with the rest of the game! and yeah, your images mostly make sense, it was beginning to seem like it was an issue potentially with blueprint construction orders, and which blueprint was creating the widget and when, as compared to which blueprint was storing/loading the Boolean value and then trying to update the widget.

Thanks! and that seems correct for what I belive was happening.