Reputation: 23
My game runs perfectly fine in debug and there are no errors at all. However when I export I get a
scene/resources/resource_format_text.cpp:1143 - res://misc/default_env.tres:1 - Parse Error:
scene/resources/resource_format_text.cpp:804 - res://misc/default_env.tres:1 - Parse Error:
editor/editor_export.cpp:1885 - Method failed
error and when I run the game is doesn't load into the main gameplay scene.
I have tried configuring project settings, removing larger assets in the main scene, exporting with and without debug and checking for any spelling errors with scene loading.
Upvotes: 1
Views: 1410
Reputation: 40220
The error is telling you that there was an error parsing the file "res://misc/default_env.tres". The file might be missing from the exported game, or might be referencing something that does not exist in the exported game.
If the file was corrupted or missing in general, it would fail when running from the editor too, so I'm discarding those cases.
As per solutions…
If it is only missing from the exported game, then make sure the export presets includes it. Similarly, make sure the export preset is not excluding some resources that it depends on.
If you have a resource file (including scenes and scripts) you can check on which other resources it depends explicitly by using the "Edit Dependencies…" option from the context menu in the "FileSystem" panel. You might also be interested in the "View Owners…" option which will show you which resources depend explicitly on the one you selected.
I say "explicitly" above because script might load other resources dynamically from code. And those dependency relationships won't be reported by "Edit Dependencies…" nor "View Owners…".
With that said, in my experience, problems loading resources in the exported game are usually due to capitalization inconsistencies (e.g. the resource path is referenced capitalized but saved not capitalized) or due to not ASCII symbols in the path.
You can fix it by changing the name of a file from Godot. When you change the name of a resource file from Godot (not from the operating system or some other software), it will update any references to it (except references from scripts).
It is also possible to edit "tres" files manually. The "tres" file extension stands for "text resource", i.e. a resource serializad in a text format (instead of a binary format). The file should be an INI, basically. So you can open it with any text editor.
Upvotes: 1