Create RemoteTransform2D at runtime

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

I was trying to create a RemoteTransform2D at runtime and assign its target:

extends Node2D
export(NodePath) var remote_path:NodePath
var rt
func _ready():

It doesn’t work, path is correct but the target doesn’t go to the RemoteTransform2D position.

:bust_in_silhouette: Reply From: klaas

maybe its because you assign the remote_path before you put it in the scene tree with add_child. This may result in an invalid nodepath.

The NodePath to the remote node, relative to the RemoteTransform2D’s position in the scene.

I think you have to add it as achild, wait for a tree entered or ready signal and then assign the remote_path.