Your first 2D game - Main gains ownership of hud.gd automatically; can't give HUD the right script anymore

Godot Version

4.6.1 Mono

Question

I was seeing the “node not found” when starting the game, and it looks like others who experienced the same issue found that their hud.gd file was also owned by the Main scene. I definitely did not explicitly do this, and I’m not sure how it happened.

I right-clicked on the Main root node and selected to “Detach script” but that did not fix it; only main.gd was removed from it. Detaching the script from HUD left Main as the only owner of hud.gd. So, I tried deleting the file, and creating a new one but now I’ve got a weird main.tscn::GDScript_0xm2m file that’s attached to the HUD child of Main. I’ve got absolutely no idea what to do here.

In my experience, the weird gdscript file is a temporary file stored in the node after you’ve removed the script, typically when a scene is made local or something like that. It’s more a symptom of your problem than anything else.

Can you share your hud.gd and main.gd?

In some cases you need to use the set_owner() method for nodes, but it’s hard to say without more context.