Can't load or preload scene in script, in exported game.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By avencherus
:warning: Old Version Published before Godot 3 was released.

Something must be slipping my brain, because I can’t recall having this issue before.

I exported a project, and there is an error in game where it refuses to load or preload an instance by the path I gave it.

Works fine from the editor.

I even tried checking the file extensions and substituting *.tscn.converted.scn

Checking the load values reveals it’s null after the load. The file_exists() on the given path reports True.

try it again after deleting temporary cache files under ~/.godot/tmp

volzhs | 2017-11-07 03:38

Thanks. Gave it a shot. Didn’t work.

I walked back everything I did last night, and the one change that caused this though was that in the export exclusion filters I put *.png to exclude the extra image files. And when I add that filter the .tscn can’t be found by preload in the main scene of the exported game, but get rid of it, and then it can…

Maybe you have an insight into this?

avencherus | 2017-11-07 07:23

just put *.png to exclude? that will exclude all png files in your project.
that might cause an error when loading scene has reference to it.
are the unwanted png files in a certain directory?

volzhs | 2017-11-07 10:12

I see, now that you mention it, I do think there was reference to a PNG that I had lingering about for testing. Some icon that isn’t shown, but was loaded via code somewhere. I would bet on that.

So I’m imagining the error was actually somewhere further upstream, if it failed to get that PNG. Does that sound plausible?

I will have to test it out again tonight when I get some time.

Thanks volzhs.

avencherus | 2017-11-07 10:19

do you have any preload("some.png") in your code?

volzhs | 2017-11-07 11:19

Yeah, it’s a load in some included script.

var icon = load(script_path + "/icons/object.png")

Was just some icon that I stopped using. Everything else was running fine in the built game, so I think I was fixated on the instance that was clearly there, but failing to preload.

One thing that made this difficult to track down was that sometimes when I made certain changes that created more fatal errors, the game would start up and close immediately, so I couldn’t get a chance to read the console.

Is there way to suspend or log the debug console on exported games?

avencherus | 2017-11-07 11:26

I think you can see logs when game runs on terminal.

volzhs | 2017-11-07 11:35

I’m using Windows, do you mean executing it from a command line prompt?

avencherus | 2017-11-07 11:38

yeap. (I should write more than 12 characters…)

volzhs | 2017-11-07 11:58

XD

I gave it a whirl, and had success. That will save me some tears in the future.

As usual, thanks again for your time and the help.

avencherus | 2017-11-07 12:06