Issue exporting: Game plays fine in editor but crashes when exported

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AddCodeluck

I’ve hammered out all the errors that were in my game but now I have one final problem. In the editor, my game works perfectly fine without any errors in the debugger menu and the Godot terminal (or whatever it’s called). But when I export the game and try to launch it, it crashes immediately. I’ve brought this up on another post of mine and someone tested it out on their computer and said that it launched fine for them. I’ve tried exporting and launching it on two different computers with the same result. Here’s a screenshot of the debugger and my export settings and the project itself:

https://bit.ly/2MVR9Po

Debugger

Export Settings

It works fine for me. There is one thing I can think of:
When you export for Windows, you get two files, one being the shortcut of the game (the one with the icon) and the other being a .pck file. Under no circumstances should you separate those two files. Are you sure they are both in the same directory when you try to run the game?

johnygames | 2020-01-05 00:02

I just had the same problem, read JohnnyGames’ comment, and his solution worked: But I can add to it! My project has a config.ini file which stores user settings between sessions. That turned out to be the missing material, so my exported file is just the .exe, .pck, and .ini files.

So if your project exports to an external file, that file has to be copied to the exported folder manually.

Heff-Money | 2021-12-27 21:24

:bust_in_silhouette: Reply From: johnygames

Ok with a bit of trial and error I figured out that your project needs access to the materials folder for some reason. It appears as if the materials used are not included in the .pck file that Godot exports. If you place the executable and its .pck file in the same directory where the materials folder can be found, it works. Otherwise it throws the error you posted.

For now, make sure to bundle the materials folder with your game until you find out why materials are not exported.

Thanks you so much for looking into this. I’ve had this problem for weeks. I’m at work right now so when I get home I’ll be sure to try that.

AddCodeluck | 2020-01-05 00:50

Just a small remark, i tried your project under Linux and materials failed to load,
turned out the project was looking for “Materials” whereas the folder was named “materials”

watch out for case sensitive folders / file names
(it matters everywhere except Windows:-)

GameVisitor | 2020-02-23 08:49

So does it work now?

johnygames | 2020-02-26 10:07

Thank you so much! That was the problem but may I ask how did you manage to find this root cause? I am wiggling with this problem for like two weeks now tried so many things but you seem to locate the problem in a few hours? What is your method?

istemihan | 2021-05-12 07:25

:bust_in_silhouette: Reply From: Entity2020 studios

There is an option to embed the pck file within the game. It means that the game hopefully won’t crash due to missing resources.