#.connect not working

13 messages · Page 1 of 1 (latest)

real solar
#

I cannot seem to connect to an emited signal properly. The class in question uses a
signal cameraFlip which I have manually connected to a separate class and is working as expected.

But my instances connecting via code don't see to have any effect. I've tried 3 different ways and non seem to call the testing method i specified

GlobalManager.CameraController.cameraFlip.connect(testing)
$/root/World/CameraPivot.connect('cameraFlip',testing);
$/root/World/CameraPivot.cameraFlip.connect(_testing.bind(self));

If i try use multiple, it does complain saying its already connected. But I just cannot figure out whats missing. Any help would be appreciated.

clever bough
#

Is your signal being emitted? Also, that .bind(self) is not necessary because that function doesn't accept any args

#

I also assume your CameraPivot class has the signal cameraFlip, but double check that just in case

real solar
#

yeah, I didnt think the bind needed, but was trying everything I could.
I do have the emit happening. That same emit even is triggering the action in another node/class which is working fine. But that one was manually connected from the ui

#

as far as I know the emiting class just needs some like this

extends Node3D
signal cameraFlip;
...
func _someMethod():
    cameraFlip.emit();

which is what I have

clever bough
#

You're doing everything just fine it seems. You're not overriding these ready and testing methods with a child class, right?

real solar
#

shouldn't be, but I'll run through my project again today with fresh eyes and hope I find something

steel orchid
#

Have you checked to make sure that you were actually able to retrieve the CameraPivot node from the scene? It looks like you are trying to retrieve it using a hardcoded path via the $ shorthand and that path that you gave it might be incorrect.

real solar
#

didnt get a chance to work on this today, but yes. I had considered that as well and did some conditional checks and called to some test methods to validate that I had access to the node and the paired script

#

I feel like this is going to be something very simple and dumb. AUshrug

steel orchid
#

here is a different syntax for connecting signals. Try using this in place of what you have and see if that makes a difference. you'll need to get a reference to your CameraPivot node.

#
CameraPivot.connect("cameraFlip",Callable(self,"_testing"))
real solar
#

So I was curious if it was an issue because I had set both a direction connection in the editor to my player controller, and was using code to connect in my other scene nodes and decided to make a second signal just to connect to and test.

The second signal worked fine, so then I went and disconnected the first signal in the editor to my character, and tried connecting via code. I then started getting errors not providing the right number of arguments despite it being correct (and nothing about the signal/emit having changed)

Then I updated the second signal with the same provided argument that was used by the first signal, and had both my player and other nodes connect to it via code.
And had no problems.....

I dunno whats going on there, but I just renamed the new signal, and got rid of the old stuff and will move on with my lifefor now...