Open smedelyan opened 3 months ago
Do the resources reference the scene they're used in?
Unfortunately without any details this isn'tgl going to be easy to resolve, so it'd be almost necessary to create an MRP
Something to try:
Does that fix anything?
Do the resources reference the scene they're used in?
They don't. They are mostly plain containers and only reference some other smaller containers of data (self-contained, not external)
Delete the project's .godot folder
I had problems sometime ago when something happened to my .godot
folder and everything in the project just stopped working because all the references have been lost. I suspect that this, in fact, might have been caused by the presence of circular references between scenes and resources, - and I believe it's actually a valid case to have such references (it's maybe only matter of properly cleaning them), so I'm afraid removing .godot
would get me into even more troubles :-)
I suspect that this, in fact, might have been caused by the presence of circular references between scenes and resources, - and I believe it's actually a valid case to have such references
I agree. It's a requested feature and may be possible in a future release of Godot.
But right now as of 4.3, circular references aren't supported, and if this project has circular references it will never export correctly. What's more, the longer it's left in this state, the more likely data will be lost. If it's an important project, the circular references need to be purged ASAP!
if this project has circular references it will never export correctly
So far it has been working correctly. The only issue is in saving the scenes: uid of a resource can't be saved because of circular references between resource and a scene, so Editor just uses the path to resource which is ok to me.
Anyway, this circular reference topic only relates to why I wouldn't like to delete .godot
. The scenes that had issues with loading exported resources may have circular references, but only in runtime (e.g. I have spawners which "know" of creatures and these creatures also "know" of an owning spawner). And even so this does not explain why it fixed with no issues when I duplicated the resource with all the equivalent data. The resource itself does not have any references to anything and is only used in one particular scene (per creature type). With that in mind, I don't believe that the issue can be easily explained by some circular references somewhere in the project (at list this relation is not obvious).
uid of a resource can't be saved because of circular references between resource and a scene, so Editor just uses the path to resource which is ok to me.
Please share a snippet from the tscn of this. Let's clarify what's going on.
I have spawners which "know" of creatures and these creatures also "know" of an owning spawner
That's fine, the spawner and the creature are part of the same scene so any references will be serialized internally as a node path. If the creature were to instead reference the scene itself @export var myscene: PackedScene
then it would become circular and data will be lost as Godot defaults to null when it can't resolve the reference.
Please share a snippet from the tscn of this. Let's clarify what's going on.
That was quite long ago, lots of changes have been made since then. It looked like regular tscn with the only difference that the offending reference had uid pointing to a non-existing resource. I saw messages in the console that editor didn't find that resources and loaded it by path. When I fixed that uid manually (by taking a look at the resource's tres and copy-pasting its valid uid), the editor crashed on scene load (the one which tscn I updated with the correct resource uid).
I'm sorry that I'm not of much help in this question. I'm fine with closing this issue as I cannot really provide meaningful input for you guys to analyze.
Tested versions
System information
Windows - Godot 4.3 beta2 (and beta3 too)
Issue description
I've described the issue here: https://forum.godotengine.org/t/exported-game-has-issues-with-loading-resources-in-export-variables/73060
Steps to reproduce
Sadly, I can't come up with an mrp to reproduce this. Neither I can publish the full game project here. I'm posting an issue here as suggested on the forum - maybe someone has an idea what's happening and why - but I don't really believe or expect any help because there's no MRP... Anyway, maybe this will get addressed someday.
Minimal reproduction project (MRP)
hard to reproduce