-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
PR #84167 seems to cause corruption in scene files with exported references to PackedScenes #86187
Comments
I managed to reproduce it only once. Seems to be random, making it difficult to test. |
Just to make sure, did you restart the editor for each test? It only ever happens on the first run for me, but has never failed to happen on a first run in 10+ tests. |
Yes, I did restart the editor multiple times. |
It does not occur consistently upon opening the project for me, either, however there is a series of steps that seems to cause it to reproduce consistently (on my machine):
|
Good point. I realise now my particular configuration of open tabs is not preserved in the zip. Sorry, I didn't think about that. The bug seems to only trigger when both a.tscn and b.tscn are open in tabs (with A in the first tab and active, if that matters too). Only having the a.tscn tab open does not trigger the bug. It seems the act of opening/loading the b.tscn tab corrupts a.tscn's reference to b.tscn. It's also repeatable in that you don't have to quit the editor:
|
The bug can occur under other circumstances, but I have not been able to identify them with any certainty. In my own project, I have a |
Fwiw, forcing As best I can tell it's the godot/core/io/resource_loader.cpp Line 343 in bf8dd73
call that's breaking a.tscn during the loading of b.tscn. Digging deeper, it seems to me like resetting the Lines 69 to 77 in bf8dd73
This empty path_cache will then cause Resource::get_path to return an empty string and Resource::is_built_in to return true , both of which seem problematic?
What's supposed to happen to the existing resource when it's evicted from the Simply commenting out the line resetting the |
Ok so there is a problem with CACHE_MODE_REPLACE. It causes the file to get loaded from disk and take over a path. The problem with this is that if any other instance of this resource exists, it will be disconnected from the original. This behavior might be fine at runtime, but in editor it leads to bugs like this one. When resource is reloaded, it should instead update the existing instances, not replace the cache as if they didn't exist. There is |
This issue could be a current show-stopper for many who are trying 4.3 at the moment. I managed to destroy a lot of PackedScenes. Good I'm using VCS, but sometimes the error happens without taking notice and can cause weird bugs: For example intentionally removing a node from a scene that is being used as PackedScene somewhere else, but it will still spawn when playing that scene. (if it has been embedded already) |
See #86918 for another MRP. |
It stops the bug, but something's not right under the hood. You get this error when you open the scene (the one that is being loaded elsewhere as a PackedScene) in the editor:
|
Tested versions
Reproducible on custom build from main 4.3.0-dev f8a2a91.
Not reproducible if 2e94be2 is reverted.
System information
Godot v4.3.dev (30b60b6f9) - macOS 13.6.1 - Vulkan (Mobile) - integrated Apple M1 - Apple M1 (8 Threads)
Issue description
Running a scene A with an exported reference to a PackedScene B causes corruption in A's scene file. It seems to embed the B scene as a SubResource instead. In an actual project I've also seen it randomly regenerate ids in scene files.
This seems to only happen the first time the project is run after starting the editor.
Steps to reproduce
Minimal reproduction project (MRP)
PR84167bug_MRP_20231215_1406.zip
The text was updated successfully, but these errors were encountered: