How to connect an Area's 'body entered' signal to a body in another scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Macryc

I have a scene in which I have an area node. I want this area node to send a ‘body entered’ signal to a body in another scene. (I will then want to instance this scene in the other scene which also has the body in it.)

My Connect Signal screen only allows me to connect the signal to nodes which exist in the same scene as the area node. My rigid body to which I want to connect is in a separate scene though.

The screen has a ‘Path to Node’ field at the bottom. I’ve tried using absolute paths here to connect to my target body, but I always get the same error: Target method not found! Specify a valid method or attach a script to target node.

Please help.

How does target scene receive signal when it is not even instanced ?

lowpolygon | 2020-01-13 08:29

It’s instanced a few times and will be a few more times. This wasn’t the problem. The problem was that using Godot’s connector screen only allows you to connect signals to nodes in the same scene as the emitter’s.

I’ve figured it out though. I manually connected the area node’s ‘body entered’ signal to my rigid body in a script instead using get_node. I find it weird however that the connector screen would not allow it. Seems a very basic thing.

Macryc | 2020-01-13 08:49

Sorry I misunderstood you. I thought you were asking how do connect signal to an uninstanced object. Anyway, I have almost never used built in connector. I have always just coded it in.

lowpolygon | 2020-01-13 09:30

I believe in this case you simply connect it through code. I assume that when your code actually run both scenes will be loaded, in that case you should be able to connect it to where you want, to check what the path is like when that happens you can open the debugger and click on the Remote button to check what your scene tree currently looks like.
Personally, when I need to do this kind of stuff, where my scene tree might be different depending on how my game is progressing, I create helper methods at the scenes root script to get whatever is inside, the path to the signal in your case.

tastyshrimp | 2020-01-13 19:16