So basically, I have a very simple game of a main menu node and a level node. I can switch effortlessly from the main menu node to the level node by preloading the level node and using it with change_scene_to_packed(), however, I can't do the same when transitioning from the level node to the main menu node. I have a button that, when pressed, emits a signal that then triggers the function to go to the main menu. the problem is I'm always met with this debugger error:
#Unable to change scene back to main menu node
36 messages · Page 1 of 1 (latest)
I've tried using change_scene_to_file() with the scene path to the node but that also returns the same error. It's really weird...
Can you open your menu scene in the editor?
sure, here is the scene with the tree
here is the code
here is the custom_change_scene_tp()
I can assure you this isn't the issue as when switching back from the level I've not used this and instead used bare functions.
That is weird... can you try using that to switch to an empty scene?
an empty scene as in it doesn't even have a node in it?
I can't create something like that. maybe just a regular node?
You can try switching to any scene. We just need to check if only your menu is affected.
I can and it works fine
the autoload isn't the issue, from inside the level itself I can't call any of the bare functions that are used to switch scenes, let me demonstrate with a video
Oh wait, from inside the level I can change to the empty scene I just created
I only can't switch to main menu
Does your menu have other dependencies?
If you don't mind sharing, what does your main menu script look like?
main menu script
TransitionEffect is an autoload
let me try commenting all the code out and starting from the level itself
it works that way
something in the code must be interfering
Is your level scene preloading your main menu?
nope
this is odd but I think it has to do with all the preloading that's going on
let me instead use switch_to_file and see if that fixes it
by the way, the level wasn't preloading the main menu node, it was the pause menu node which is a child of the level node that was preloading it:
This is the closest thing I can find relating to your issue.
Apparently, scenes can also run into trouble with cyclic references if they preload one another.
https://github.com/godotengine/godot/issues/72921#issuecomment-1423244325
it works now
ah thanks. I'll check that out.
nice! good luck with your project!