SignalPrinter

by Duke

10

SignalPrinter

Plugin for monitoring signals of a global EventBus singleton.

While creating Godot projects, developers often use a global signal script, a singleton, which houses only signals needed for unrelated systems to talk to each other. These scripts go by names like EventBus, MessageBus, Signalton, etc. One downside these scripts often have is the inability to see under the hood, as there isn't an easy way to monitor multiple signals being emitted. Developers often have to resort to using print() statements on each end of the signal path.

This plugin adds a SignalPrinter node, which automatically connects to all signals of your global EventBus and routes them to a method, which prints the signal's name, all arguments and (optionally) the time at which the signal was recieved.

Example output:

player_interacted

with : Node3D = Pickup:<Area3D#41657828805> // The type is the same as was declared in the signal itself

time (ticks msec) = 4647

inventory_item_changed

item : Item = <Resource#-9223371996253911657> // It even recognizes custom Resource types (Item)

index : int = 1 // And has support for Variant types

time (ticks msec) = 17442

Example output screenshot

Usage

You need to replace global_bus in signal_printer.gd script with your own singleton's reference. Otherwise you get an error.

Example

If your global bus is named EventBus, you simply replace null with EventBus

From:

static var global_bus : Node = null

To:

static var global_bus : Node = EventBus ✔️

You pass the singleton in directly, not by its name.

static var global_bus : Node = "EventBus"

After that, you can add this node anywhere in the scene and remove it, when you don't need it anymore.

Node in scene Node properties

Warning

As GDScript currently doesn't support variable argument count, arguments in the function are added manually. Currently, the max argument count per signal is 10, but if you need more, you can add them easily.

Further reading

How to create an EventBus in Godot

Theory behind the Observer pattern

Version

1.0

Engine

4.2

Category

Tools

Download

Version1.0
Download Now

Support

If you need help or have questions about this plugin, please contact the author.

Contact Author