Question about accessing nodes

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

Hello guys,

maybe you can help a noob out.

I have the following tree:


Room0 is a child scene and instantiates an enemy scene within its script My enemy navigation needs to know the global position of the Player node. Before i added room nodes i had enemies as direct children of game. But now my room script instantiates them via script

I tried to drag and drop my Player in my enemy script. But it says “Can’t drop nodes because script ‘*)’ is not used in this scene”

Anyone knows how i access the player position?

Thanks a lot!

:bust_in_silhouette: Reply From: zhyrin

When your room is created, before it creates the enemies you should get the player with a global node path. After you create an enemy, you can set it’s player variable.

Thx, i was able to fix it with proper pathing :slight_smile:

Sven | 2023-03-17 10:56