Sorry for stupid question, but i don’t understand. What difference between this two variants
In the example on the top, the event gets dispatched when the node it’s binded to gets triggered. This specific node you got here logically searches for an event to call due to it’s nature, that’s why it has that pin named “callback”. (I was gonna correct this but wanted to keep my last sentence to show the wrong way of thinking, it’s not actually that node that calls the event) About event dispatchers, their main purpose is to be able to maintain communication between multiple sources.
If you want to dive deeper, here’s a topic with many detailed explanations in it, specifically this single post right here sums it all up: Why use an event dispatcher over calling a function? - #4 by CriErr
The difference is that in the bottom one, you’re manually calling “Custom Event” directly in the setup Blueprint graph (and will always execute once and only once). The bottom “Listen for Input Action” node doesn’t even need to be there. The “Custom Event” will execute immediately regardless of anything that came before since it’s next in line to be executed right away.
In the top one, your “Custom Event” is called every time the user executes a specific action.
Said differently, the top “Listen for Input Action” will store the delegate to “Custom Event” for later use. When the specified action is triggered, it can call that delegate (or event) that you specified.
Top one is: Store delegate for later. Can call delegate later.
Bottom one is: Call node NOW (and only once).
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.