Select node via @export in Editor in different scene

Godot Version

4.2.1

Question

I’m working on scene transitions. So the Area for the transition is in World1, the target position is in World2.

Currently in the “SceneTransition.gd” I’m using

@export_file() var sceneFilePath
@export var targetPlayerPosition: String

Later I load the scene, instantiate it, add the player-node and set its position to the position of the node under NodePath(targetPlayerPosition).

Ideally I’d like to select the node path directly in the editor in World2.tscn. But since the SceneTransition-node is inside World1, I only get the selection dialog for the nodes in World1.

Is there a way to get a selection of the nodes in other scenes than the scene the node is currently via the Inspector?

Nodepaths are relative within the tree, so there is no relative path to the nodes from your World1 to World2 if ther are separate scenes.

You can have a script in World2 instead where you set the path in the inspector and then you’ll be able to access that from World1 after you load your reference to World2.

What do you mean by “script in World2”?

I’ll try to clarify what I’m doing.

The way it works right now is that the “SceneTransition” node in World1 is triggered and loads the scene for World2.
Then it looks for the node under NodePath(targetPlayerPosition) in World2, gets that position and sets the players position to that.
That’s working fine and there’s no extra script needed in World2, just the node for the position.

What I’m wondering is if it is at all possible to select a node in a different scene from the Inspector via @export vars. Right now it doesn’t seem like it.

In the end it’s just a matter of convenience, since the transitions are working.

I haven’t tried Advanced Exports yet, maybe then I could load the tree under the scene selected in sceneFilePath whenever that changes.