How to know if a signal is triggered in a script from another script in C#

Godot Version

4.2

Question

C#
There is a player script and an attack script. The attack script has an Attack signal. I want to track in the player script that the attack script has an Attack signal, without connecting it through the inspector, to do everything in the script editor.

There are functions to get signal lists. Just search the in-editor docs and search for methods with signal in the name. There are also methods to get connections for incoming and outgoing connections.

I typically would take a weapon class and give it a class name so I can do this. Sorry this is in gdscript

Var wep:MyWeapon = get or make my weapon

Wep.attack.connect(self.attack_method)

It would look something like this in C#. It’s a bit hard to give a proper example without context around it.

MyWeapon weapon = something; // Get or make the actual weapon object.

weapon.Attack += AttackMethod;

There is more information on the documentation page about signals in C#.