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 Add-ons or Instances to create logic that works right out of the box, no linking required.
|Enabled||Determines if the component is executable|
|Listen To||Identifies the signal the Broadcast Listener is listening to|
The Broadcaster Listener will always be used along with a Broadcaster. The Broadcast Signal connects Broadcasters to Broadcast Listeners. When a Broadcaster is executed every Broadcast Listener that is listening to that signal will execute it's functions.
To keep this example easy to follow we'll be making a pretty basic connection between a trigger and an action. We have a button that is a physical object in the game world. It is already equipped with an Object Touch Component so it can used as a trigger and a Transform & Wave Generator so it has some animation when pressed. We want it to set off an Explosion Particle Effect when the button is pressed.
Step 1: Spawn a Broadcaster. The Broadcaster can be applied to an object or as a stand-alone Component Node. Since one advantage to using the Broadcaster is minimizing spaghetti it makes more sense to apply it to the object that will trigger it. We will add our Broadcaster to the button object.
Step 2: Set up the Broadcaster
Step 3: Link Trigger to Broadcaster.
Step 4: Spawn a Broadcast Listener. The Broadcast Listener can also be added to an object or as a stand-alone Component Node. Again, to minimize clutter, we'll add the listener directly to the Particle Effect Node that it will be triggering.
Step 5: Set-up Broadcast Listener
Step 6: Link Broadcast Listener to Particle Effect
Now we test. If all was set up properly, pressing the button will activate the Explosion Particle Effect.