0 votes

I'm developing in mono and am trying to connect various buttons from other scenes to another scene to disable/enable movement buttons. I've been beating my head against a wall and have yet to figure out why this is happening.=

The project is here: https://github.com/n0manarmy/dwarf_jonesing/tree/dev_01.06.2021/src

I have my parent TravelPath _Ready connects the different scenes to the enable/disable location buttons based on signals.

The InfoScene/Scene01-13 fails to connect to DisableLocationButtons and StartValuesScene fails to connect to DisableLocationButtons.

https://github.com/n0manarmy/dwarf_jonesing/blob/dev_01.06.2021/src/TravelPath.cs

WalkingPath/Scene01-13 does however connect to DisableLocationButtons and I cannot determine why?!

The error message I get when I start either the project, or TravelPath is below:

ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene01DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene02DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene03DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene04DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene05DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene06DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene07DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene09DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene10DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene11DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene12DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'Scene13DoneClicked' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
ERROR: In Object of type 'Node2D': Attempt to connect nonexistent signal 'GoalsValueDone' to method 'Node2D.DisableLocationsButtons'.
At: core/object.cpp:1503
Godot version 3.2.3 stable mono
in Engine by (16 points)

2 Answers

0 votes

I find runtime checks based on string hard to work with. You cant get help from the compiler and if a name changes then you need to remember to update all your strings.

If your project is entirely written in c# then I would consider using events. The compiler will help you with errors if you use it wrong or if the event name changes.

using Godot;
using System;
using System.Collections.Generic;


class MyFirstClass
{
    public delegate void SomeSignalWithIntArgument(int someInt);
    public event SomeSignalWithIntArgument OnSomeSignal;

    void Foo()
    {
        OnSomeSignal?.Invoke(123);
    }
}


class MySecondClass
{
    MySecondClass(MyFirstClass myFirstclass)
    {
        myFirstclass.OnSomeSignal += MyFirstclass_OnSomeSignal;
    }

    private void MyFirstclass_OnSomeSignal(int someInt)
    {
        throw new NotImplementedException();
    }
}
by (32 points)
0 votes

Ugh, I figured it out...It was operator error

My signals were not instantiated within the class. My structures were like below. So of course they couldn't find the signals, they weren't associated with the class.

[Signal]
public delegate void MySignal();

class myClass: Node2D {
    def blah;
}
by (16 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 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.