I have a Signal inside a script attached to a node:
Game.tscn/Game.cs
using Godot;
public class Game : Node2D
{
[Signal]
public delegate void AddPowerUp(Powerup powerup);
}
I try to emit a signal from another class:
ExtraBall.tscn/Powerup.cs
public override void _IntegrateForces(Physics2DDirectBodyState state)
{
EmitSignal("AddPowerUp", this);
}
Then in another scene, Level.tscn, I instanced Game and ExtraBall. However, I get an error when I try to emit the signal.
E 0:00:05.828 emit_signal: Can't emit non-existing signal "AddPowerUp".
Here's how it looks like in the engine:
Game has the Signal and I attach to a function in Player:
In the Level scene, I instance Game and ExtraBall:
Shouldn't ExtraBall be able to know about the "AddPowerUp" signal since it was instanced under the same SceneTree? If not, how do I go about emitting a signal that's defined somewhere else?