+1 vote

I'm trying to send signals over a singleton static bus and I'm getting an error:
"SignalBridge.TestSignal" is a type, but is used as a variable. [MiniGames]csharp(CS0118)
Error in Receiver class in the line "SignalBridge.TestSignal += DoSomething"

Signal Bridge:

using Godot;
using System;

namespace Test.SignalBridgeTest
{
    public static class SignalBridge
    {
        [Signal] public delegate void TestSignal();
        [Signal] public delegate void TestSignalWithArgument(int number);
    }
}

Emitter:

using Godot;
using System;

namespace Test.SignalBridgeTest
{
    public partial class Emitter1 : Node
    {
        [Export] public bool enable = false;

        public override void _Process(double delta)
        {
            if (enable)
            {
                EmitSignal(nameof(SignalBridge.TestSignal));
            }
        }
    }
}

Receiver:

using Godot;
using System;

namespace Test.SignalBridgeTest
{
    public partial class Receiver : Node
    {
        public override void _Ready()
        {
            SignalBridge.TestSignal += DoSomething; //ERROR IN THIS LINE
        }

        public void DoSomething()
        {

        }
    }
}
Godot version 4.0.beta7.mono
in Engine by (13 points)

1 Answer

0 votes

Prototype dont use. C++

by (14 points)
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 Frequently asked questions and 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 [email protected] with your username.