get_node: Node not found error

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

Hello,

So, I’m new to Godot and made my first two projects. The first one is a platformer game the 2nd one is a Memory Card Game. Both games work fine when I run them separately.
Yesterday I got an idea to put the Memory Card Game into the Platformer Game, so when I interact with some NPCs or enemies the Memory Game will launch as a mini-game. But…

When I try to run my Platformer Game with the Memory Game inside and click a card I get an error: “get_node: Node not found: /root/MemoryGame” I think the problem is this code in my “Card.gd”: “get_node(‘/root/MemoryGame’).chooseCard(self)” .

Here is a short video to show you the problem: https://youtu.be/wuCFX_jYZ5A

So it seems like the main game which is the platformer game cannot find the “MemoryGame” file. I even tried to autoload the MemoryGame file but it didn’t help.

:bust_in_silhouette: Reply From: exuin

Your absolute path is wrong. Since you’ve added the card game as a child of another scene, its path has changed. Its new path is “/root/Level1/CanvasLayer/MemoryGame”.

Thanks, that helped!

adammasterek | 2021-01-23 16:13