0 votes

I have a world scene that routinely creates instances of another, smaller scene called Segment. Segment has a lot of internal stuff going on with many smaller parts that communicate with each other through signals. When I tested the logic of the world scene out with a less complex scene to instantiate, everything went fine. But when I swapped that less complex scene out with the actual Segment scene that I want to use, things started going awry.

Every time I instantiate one, I get a big frame rate drop, and then Godot prints the following error to the console:

connect: Signal 'my_signal' is already connected to given method 'my_method' in that object

It prints this for every single signal I have connected within Segment, which is like 10 (hence the framerate drop).

I do not connect any signals through code within Segment -- every one is connected through the editor.

Here's my code for instantiating a segment, which is in my World.gd script:

        guy = Segment.instance()
        guy.position.y = offset
        call_deferred("add_child", guy)

where Segment is the name of a variable containing a preloaded PackedScene of my Segment scene.

The weirdest thing to me is that my test scene that I substituted Segment for also has a signal connected between two of its children, but I never get this error when instantiating the test scene. Is this just an issue of having too many signals?

EDIT: After a little more testing, I've found that I do not get these errors from the first two times I instantiate Segment, but I do get them for the third time I try to, and every time after that.

Godot version 3.2.1.stable
in Engine by (35 points)
edited by

1 Answer

+1 vote

My apologies, I should have done more extensive testing, I was pretty tired last night. It turns out that I have a bug that tries to instantiate the same scene several times instead of just once, and that's where my error is coming from.

by (35 points)

Happens to all of us!

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.