The Broadcaster, Player Broadcaster and Broadcast Listener nodes allow you to send data or execute nodes without dragging links between them.
This tool is great for cutting down on the logic connections, often referred to as spaghetti, that can clutter up the Editor when there are a lot of components communicating with each other.
It can also be used for triggering many components at once or having many triggers that can activate the same logic chain.
Finally, they can be used with Behaviors or Reusables to create logic that works right out of the box, no linking required.
The Broadcaster and Broadcast Listener will always be used in pairs. The Broadcast Signal connects Broadcasters to Broadcast Listeners. When a Broadcaster is executed, every Broadcast Listener that is listening to that signal will execute connected nodes.
This example will make a pretty basic connection between a trigger and an action. There is a button as a physical object in the game world, already equipped with an Object Touch node so it can be used as a trigger, and a Mover and Wave Generator so it has some animation when pressed. An Explosion Particle Effect will be set off when the button is pressed.
First, add Broadcaster node from the Logic menu in the Bottom Toolbar. Once added, create a new signal by opening the Details panel and tapping on the Signal Out property. Next, tap on the plus button on the top right.
You can name the signal whatever you like but it will help if the name somehow identifies the source of the signal. If you have multiple broadcasters in the game, you'll want to easily be able to choose the right signal when setting up the Broadcast Listeners.
For this example, name the signal Button
since it originates from a button.
Next, create a link from the button to the Broadcaster.
Object Touch > On Touch Start
and drag a link to Broadcaster > Execute
.Add a Broadcast Listener from the Logic Menu.
Button
signal you created earlier.Drag the link to the Particle Effect Node.
Particle Effect > Executing > On
Finally playtest to see if it works. Tap the button and see what happens!