+1 vote

I have a class named SignalOrigin.cs and another class named EmitSignalTest.cs
The signal however is not found! ( I am new to Godot C# )
Here is the code:
( SignalOrigin.cs )

    [Signal]
    delegate void CreateBlock();

    public void ABlock()
    {
        GD.Print("HELLO");

    }

    public override void _Ready()
    {
        this.Connect(nameof(CreateBlock), this, "ABlock");
    }

( EmitSignalTest.cs )

if (Input.IsActionJustPressed("ui_accept"))
        {
            if(Materials[0] > 0)
            {
                EmitSignal("CreateBlock");
            }
        }
Godot version 3.4
in Engine by (13 points)

The EmitSignal method and the signal delegate have to be in the same class.

The Signal then shows in the editor. Form there you can choose the target node/script.

That should help you: https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html

Thank you, very much! For the first time I didn't understand the docs. Thank you for your help!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.