Godot Version
4.3 `
Question
Howdy,
I was reading the documentation on Signals and came across a comment describing the use of a SignalBus. Right now I am trying to to see how it works and seem to be struggling to actually connect the signal. Here are the relevant bits of code:
signal_bus.gd
extends Node
signal player_action
player.gd
func _ready():
SignalBus.player_action.emit()
enemy.gd
func _ready():
SignalBus.player_action.connect(_on_player_action)
func _on_player_action():
print("signal received")
I am fairly new to programming and am trying to rely on the documentation as much as possible before asking for help but this one has me stumped. I tried putting the argument for the signal connection in parentheses but I believe that was for an older version of Godot. I do believe that my issue lies in how I am trying to connect to the signal but can’t figure out the why. Any help is greatly appreciated, thanks!