How does the button activate another another button in "your first hour with UE5"

I was messing around with the “Unreal Learning Kit: Games” from the “Introduction To Your First Hour In Unreal Engine 5” tutorial, and haven’t been able to figure out how some buttons enable/disable other buttons in the scene—e.g., PlayerButton_BP4 enables PlayerButton_BP6 when pressed

Of course you can’t do that in the actual button blueprint, since this would be an instance-specific thing. But the only place I can think of to look for instance-specific variables is in the details tab for BP4 & BP6, but I’m not seeing any reference from one to the other

Could anyone shed some light onto how this is working?

There are two ways I can think of that would achieve this: A parent blueprint that contains all instance-specific references. so BP4 would send a message to this parent blueprint to enable BP6, and the parent blueprint would access the required instance-specific variables to enable BP6

The other option is something like Event Dispatchers / interfaces, a method I have used before. By using an event dispatcher and assigning ID’s to every button placed, any PlayerButton_BP could send out a message to all others, specifying that BP6 should enable itself. Each button would check within itself if it is BP6, and if it is, the button will enable itself. The checking process can alternatively be done by getting an array of all buttons before sending the message, and scanning the ID’s of each reference to choose which instance to send the command to

2 Likes

Ah, okay, there’re references to event dispatchers in the button blueprint so that seems more likely. But wouldn’t the blueprint also have to implement something essentially like a listener for that event, then a branch to check the ID associated with the event? I didn’t see that anywhere in the blueprint

1 Like

This is a quick mockup of the idea, if you use event dispatchers then there would have to be a listener event, so they are not ideal. the main reason I used them is because they did the trick and i couldnt quickly find a better way, although there is no doubt in my mind that there is a better way

2 Likes

Amazing, tysm! Glad to see I was barking up the right tree and not just overlooking some super obvious tab in the UI lol

1 Like

I feel I should clarify multiple things before I spread misinformation:

The ID system i showed you is quite literally the interface system, for those who don’t understand the actual interface system yet. (like me) If you are considering using this in a genuine game, please look into Interfaces instead.

As for the parent blueprint idea, this is very rarely used, since there is very often a better solution, either through interfaces, event dispatchers, or direct references.

Lastly, I would like to emphasize that I personally have not ever opened this project, and they could be using a very different system. If you want I can help you figure out exactly what they did, instead of telling you how I might have done it. Please paste the button blueprint into the same site that I used to share my ID system so i can help you with that, if you so choose

1 Like