Hey I haven’t found any solution to disconnecting all signals connections of a signal emitting node using c# yet. This is what I have tried so far but it didn’t work:
public void DisconnectAllSignals(Node emitterNode)
{
foreach (Dictionary signal in emitterNode.GetSignalList())
{
foreach (Dictionary connection in emitterNode.GetSignalConnectionList(signal["name"].ToString()))
{
emitterNode.Disconnect(((Signal)connection["signal"]).Name, (Callable)connection["callable"]);
}
}
}
In my test case I have two predefined Signals in the emitters script. When printing out signal name, callable target and callable target method in the inner foreach loop like this:
GD.Print(((Signal)connection["signal"]).Name + "; " + ((Node)((Callable)connection["callable"]).Target).Name + "; " + ((Callable)connection["callable"]).Method);
both of the two predefined signals have in addition to their normal connections a connection to themselves with the callable.target node beeing the emitting node and the callable target method beeing the signal.
Error:
Attempt to disconnect a noneexisting connection from [emitterNode]. Signal: 'MySignal ', callable: [emitterNode] :: 'MySignal '.
So appearently my emitter node has a signal connection to its own signal for some reason?
Does anyone know what I am doing wrong here?