Here’s the thing: “scenes” don’t matter when the game is running. All you have is a bunch of nodes in the scene tree.
The error you’re getting is because the path you have in that get_node() is returning null instance because it’s invalid. You need to look at your scene tree and use the correct path to the node you want.
If you post a pic of your scene tree, I can probably show you exactly.
Thank you for your answer…
I understand that this error could be generated from a wrong path, but i highly doubt it …i have checked a million time!!
onready var game_music = get_node("/root/main/backgroundMusic")
again your help is much appreciated.
u_nes | 2020-05-02 00:27
What node is the script with that line on? onready is probably your problem. Children become ready first, so “main” is going to be ready last. Calling this in the ready of a node that’s further down the tree will not work.
kidscancode | 2020-05-02 00:36
the on ready line is in a different scene in the same directory as all other scenes
i used the same line to access themeSong from main_menu scene and it worked but backgroundMusic loaded from main scene is causing problems
The “directory” has nothing to do with it. When you run the game, the nodes are all in the scene tree, and they become ready in reverse tree order. You can’t call a node that’s above during _ready().