-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nonexistent resource error when trying to use change_scene_to_packed() to change the scene to a PackedScene via an exported variable when the target scene also has a reference to the first scene #77090
Comments
IIRC cyclic scene references are NOT a supported case |
Maybe we should improve the error message. We had many such reports. |
I just spent hours debugging a problem that turned out to be this issue. It would be great if the error message stated where the script has been preloaded so it's easier to debug this kind of problem. |
I just ran into this same issue, but it seems that the affected files become permanently broken. We need a way for a warning or error to happen, but be able to fix it. Someone does this by accident in a large game and it could become disastrous before they truly realize what has happened. Given we should all have our projects backed up, this is still problematic. |
In my case, I was able to fix it by getting rid of a |
Yes you are correct. In some cases I later found if I reloaded the engine it fixed it at that point in time. |
Godot Engine v4.2.dev3.official [013e8e3] I have been scratching my head at the same problem, and have had to manually edit the scene files to un-corrupt them once or twice. After some fiddling, I have found that setting the ResourceLoader.load cache to IGNORE :
allows me to use one scene such as a "door" to load back and forth between levels. full switch scene function (accepts a PackedScene.resource_path)
This does spit out an error everytime the next scene in the circular scene switcher loads:
and so on. |
seanluse41's workaround works until I close and reopen Godot, then my scenes get corrupted and I have to remove all the "ext_resource" lines and set them again in the editor. Is there any way to achieve this that doesn't cause corruption? |
You can use |
"Use Just came across this same issue. As said in another ticket (#77436) by the team staff: Also refer to: |
- Added globals autoload to keep track of variables between scenes (currently only used to take the desired spawn location from a scene changer into the next scene and spawn the player there) - Also fixed a bug with changing scenes (code was correct but an existing engine bug prevented loading between 2 scenes back and forth with the previous implementation, for more info see godotengine/godot#77090)
- Added globals autoload to keep track of variables between scenes (currently only used to take the desired spawn location from a scene changer into the next scene and spawn the player there) - Also fixed a bug with changing scenes (code was correct but an existing engine bug prevented loading between 2 scenes back and forth with the previous implementation, for more info see godotengine/godot#77090)
- Added globals autoload to keep track of variables between scenes (currently only used to take the desired spawn location from a scene changer into the next scene and spawn the player there) - Also fixed a bug with changing scenes (code was correct but an existing engine bug prevented loading between 2 scenes back and forth with the previous implementation, for more info see godotengine/godot#77090)
Are there any plans on fixing this yet? If not what are some simple flexible ways to implement scene switching? |
#97912 will allow to export PackedScenes by path, so you will be able to do |
I was also able to find that the issue can be partially circumvented (at least in my case) by replacing my |
Godot version
4.0.2
System information
Windows 10
Issue description
I created a button that, when pressed, called change_scene_to_packed() with a PackedScene variable as the target. The variable is exported into the editor, where I can then drag and drop a scene into it for the button to change the scene to.
This works fine, the button changes the scene to the target scene. If the target scene also has another instance of the button in it linking to a third scene, that also works fine.
However, if one of the scenes links back to an earlier scene, it crashes and only produces an error in the console, not in the editor itself.
Here's the error when I have scene1 link to scene2, scene2 link to scene3, and scene3 link back to scene1:
When I tried saving the project and reloading it, I got a "Load Error" dialog with an empty message box and this error in both the console and the debugger:
The button in the last scene is also stripped of its target scene. This happens whether or not I run the project after assigning the variables in the editor.
If I use change_scene_to_file() and use a file path string instead of a PackedScene variable, the scene loop works fine. This only happens when using change_scene_to_packed() and a PackedScene variable.
Steps to reproduce
The minimal reproduction project contains a version with two scenes. If you use it, make sure you reassign the button's targetscene variable on the second scene to scene1.tscn since Godot empties it upon loading.
Minimal reproduction project
repro test both scenes.zip
The text was updated successfully, but these errors were encountered: