-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Scene is invalid/corrupt according to the Godot editor, but works normally ingame #79545
Comments
Same thing happened to me after adding a material with a shader to a sprite node of my scene. I checked the paths in the .tscn file and they're ok.
Its associated script:
The shader:
Edit: I restarted the app a third time and this time, I could opened the file. It feels even more disturbing. |
Sounds like #78128 |
See also #74253 (comment). I also think this is a |
I got this every time in 4.1, but updating to 4.1.1 fixed it immediately. Huh. |
Here's what working for me to fix this error: close editor, search in the .editor folder for all files containing the corrupted scene's name (they are going to be name something like your_scene_name.tscn-editstate-2e5312b3e75d2338868814f479b1feeb.cfg), delete them, restart editor. |
Oh, is it still a thing? I thought it was fixed, but maybe it just randomly disappeared when I updated once. |
I'm on 4.2 beta5 atm. Scene is invalid/corrupt error seems to have multiple causes, so my source of this issue may be different, but in my case the steps above fix the problem. |
But is it related to this particular issue, i.e. scene was corrupt, but had no problems at runtime? |
@KoBeWi Hmm, if I recall correctly errors were thrown at runtime as well, though my amateur interpretation was that the deleted editstate and folding .cfg files shouldn't have an effect on runtime since they seem to relate to the editor |
Had the exact same issue on 4.1.3 stable, and this fixed it! |
Got the error again, and the above steps did not help this time. What helped was: duplicate scene in a file explorer (not in Godot editor, since the error stays that way), open the duplicated scene (it opens without the error), 'Save As' the scene overwriting the original scene. |
This issues keeps reoccurring for me (4.2 rc2)... Updated instruction on how to (temporarily) fix, since the above instructions not always worked for me (do each step for each corrupted scene file, as I found there can be more than one):
|
Can you test the issue after #85083? (available in 4.2) |
For me the issue hasn't reappeared in 4.2 stable yet. Will try this out if it does. |
This issue keeps occuring for me in 4.2 stable. error
room.tscn
@PLyczkowski 's solution still works, albeit kind of annoying. I open VS Code, copy paste |
I had the same problem on 4.2.1 stable. The wordaround |
Reproduction project: |
I wasn't even thinking about this, but when that problem happened to me I was working on preloading some scenes. After saving and reopening the project, "Scene is invalid/corrupt". |
Got the same error message as @JRileyH on mine in 4.2.1 after the issue reappeared: "scene/resources/resource_format_text.cpp:284 - res://card_engine/board.tscn:10 - Parse Error: I noticed I am preloading a script with a class name in there while the script already registered that name using class_name. So in corrupted scene: |
Same issue/error on 4.2.2. On my 3rd scene rebuild cycle. I ensured my variable names were not the same as the class names that were being preloaded and the corruption happened without any changes to the scene before corruption. |
Got a scene in another project that's glitched like this. 2 in 3 times I open Godot, it refuses to open, but sometimes it does open correctly, if I close and re-open Godot enough times. It's on my open-source project, and other contributors seem to also be having the issue. |
Is there a known way to structure things to avoid this problem? Project I am working on is pretty much at a standstill due to it as all attempts to work around it have resulted in it again. |
Use another editor to remove preloads in scripts. Type annotation can be seen as an indirect preload so remove them as well. Write export var PackedScene instead of preload tscn. These workarounds should be sufficient to make the project editable again before the fix is delivered in 4.3. |
Thank you for the guidance. The corrupted scene does not have any preloads in it's script. Should this be done for all scripts attached to scenes that load into the corrupted scene? The scenes included into the corrupted scene were added through the editor and not programmatically. |
This particular situation is more complicated than I expected. I can only wish you good luck. |
If I figure anything out in my troubleshooting I'll report it here. Thanks for the help! |
I rebuilt the scene last night. Had it fully working. The scene has no direct preloads, or loads in its script. Through the editor I instantiated my character scene which does preload the pause menu. No issues while working on it for about 2 hours last night. When I woke up today the scene is corrupt. I verified with git diff that the scene file had not changed at all. The only things in the scene were the instantiated character and a tilemap. The same bug seems to be also effecting a plugin I am using Dialogue Nodes. With this plugin a set of characters is defined in a tres file. I have found that anytime the main scene becomes corrupt, the character.tres file also stops working inside the editor and errors with 'Parse Error: Node export is only supported in Node-derived classes, but the current class inherits "Resource".' which is super weird because as with the scene, nothing has changed since last night. The only way ive been able to get things working is by deleting and recreating all effected scenes/files from scratch. I had tried manually removing ext lines from the scene, deleting things in the .godot/editor folder, and a few other of the fixes I have found in other threads that are not on the top of my mind at the moment. Don't know if any of this is helpful but trying to provide as much data as possible for people more knowledgeable than me. |
Apologies for the data dumps but want to provide as much information as I can. This time I was able to get the main scene working by deleting the reference to the player:
The character.tres file is still an issue, but I was able to recover the main scene. The player node's script does do quite a bit of preloading and child creation. |
Nope, removing those did not stop the issue from reappearing |
I've also been experiencing this with one the scenes in my latest project. I think one thing that's sometimes gotten confused along the way is that (at least in some cases) it's the scene which is being preloaded that gets corrupted, not the the scene doing the preloading. On testing out the repro bee project, I noticed that it only seems to happen the first time you open that project - ie. before the |
Just to add to this thread. I have a fairly large project. I just now hit this randomly in 4.2 stable. Replacing "preload" with "load" did fix the problem. And I don't have any name clash issues like others have reported. |
Getting this issue or something similar on v4.2.stable.official [46dc277]. I have a script A with a preload of scene B, and the script B for that scene had a preload of a different scene C (that did not have any preloads). Removing the preload reference in either script solves the issue. But I still need a way to load that scene C, and using preload or even load cause the error. I've duplicated the "corrupted" scene a few times and attempted to reset it based on the suggestions here, but to no avail. Is the merged fix supposed to work for the latest 4.2 stable version? Or 4.3 |
This hasn't been cherry picked but is planned to be in a future 4.2.x version (note the PR has the |
Godot version
4.1
System information
Ubuntu 22.04.2 LTS 22.04 - Vulkan (Forward+) - integrated Intel(R) HD Graphics 4400 (HSW GT2) () - Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz (4 Threads)
Issue description
This is the tscn file:
It results in this:
And the following error: "scene/resources/packed_scene.cpp:92 - Condition "nc == 0" is true. Returning: nullptr"
It also creates adds an empty scene in the scenes tabbar, and when I click on it, it automatically closes, throwing the following two errors:
Steps to reproduce
Unknown, only happened to one of my scenes :(
However, I can give some details surrounding the scene. I made it at some point during 4.0's alphas. I probably never touched it since. In my git, it says it's been unchanged for 5 months. However, I opened it yesterday. Not doing any changes to it, just opening it. It has a simple script, which opens normally.
Minimal reproduction project
Couldn't, this happened on my major project (far too big to post)
The text was updated successfully, but these errors were encountered: