[Help] Import/link another node on GDscript

Looking at your scene tree, the get_node() should work. Although I would caution against using such code in that way.

Let’s call the scene with the world, camera scene, and player scene etc. the “main” scene.

I suspect this should run fine in the main scene, but if you run the camera scene by itself get_node will fail and return null.

They tutorial does this another way.

You need to export a variable target node

@export var targetNode:Node2D = null

Then in the inspector pane select the player node from the list.

2 Likes