unable to load scenes after exporting.

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

I’ve been struggling with this issue for a while now. The project works fine in Godot but after exporting, scenes don’t get loaded. At the beginning of the project, when there were fewer scenes, it was ok but at some point few of the scenes weren’t getting loaded and now most of the scenes are not getting loaded.

At first I thought it was an issue related to file names or extensions. So I iterated through directories.

func dir_contents(path):
	
	var dir = Directory.new()
	var text_1 = ""
	
	if dir.open(path) == OK:
		
		dir.list_dir_begin()
		var file_name = dir.get_next()
		
		while (file_name != ""):
			if dir.current_is_dir():
				print("Found directory: " + dir.get_current_dir() + "/" + file_name)
			else:
				print("Found file: " + dir.get_current_dir() + "/" + file_name)
				
			file_name = dir.get_next()
	else:
		
		print("An error occurred when trying to access the path.")
		
	pass

But all the scene names and extensions weren’t changed and they also didn’t move or anything.

ERROR: load_interactive: Condition ' err != OK ' is true. returned: Ref<ResourceInteractiveLoader>()
   At: scene/resources/scene_format_text.cpp:1225.

Still on the exported ver this err keeps popping up. I’ve exported to OSX and iOS but on both of the os, stuck with the same issue.

Please help.

What OS are you using for development ? You can check the following :

-The casing of the directories and extensions ?
/test/MyScene.tscn is different from /test/myscene.tscn

-You are using the correct resource folder : res:// and NOT user://

-Add print statement to a auto-loaded global script

Good luck

GameVisitor | 2018-04-21 10:49

I’m currently using Mac 10.13.4

And i already checked all the things that you’ve mentioned but sadly none of them made any difference.

Thanks for the comment tho.

di | 2018-04-21 12:01

Found file: res:///scenes/1F.tscn

ERROR: load_interactive: Condition ' err != OK ' is true. returned: Ref<ResourceInteractiveLoader>()
       At: scene/resources/scene_format_text.cpp:1225.
    ERROR: _load: Failed loading resource: res:///scenes/1F.tscn
       At: core/io/resource_loader.cpp:186.
    ERROR: load: Error loading resource: 'res:///scenes/1F.tscn'
       At: core/bind/core_bind.cpp:79.

This is the err message when I run it on terminal.
load(‘res:///scenes/1F.tscn’) returns null even before instancing it. Which is odd cuz when I check directories using dir_contents(path) function, all the files r in the right place.

di | 2018-04-21 12:16

:bust_in_silhouette: Reply From: stubbsy345

Is your scene loading any extra files that aren’t exported as standard? For example I had a similar problem as my scenes rely on some JSON files, but these aren’t exported without specifying you want to export *.json in the resources section of the export.

No extra files, such as JSON files, r needed in my project. So I don’t think that’s the case.

di | 2018-04-21 12:09

This was the issue for me. Thank you for the tip! I also want to have my .txt files visible in the filesystem for use. Do you know if there’s a way to enable that?

ValueChip | 2019-05-27 18:07

:bust_in_silhouette: Reply From: GameVisitor

One thing is weird in your output and it is that your getting 3 slashes ‘/’ instead of 2 …

ERROR: _load: Failed loading resource: res:///scenes/1F.tscn

Make sure in your project settingsRunMain scene you dont have an additional ‘/’ in your scene path.
I just tried adding a slash and it run from within Godot (under Ubuntu 16).

Yeah i already tried using 2 slashes in general and tried setting main scene with 2 slashes but there was no difference.
The reason of 3 slashes is that while I was googling around, i read something like that unix system (i’m using Mac 10.13.4 right now and exported to Mac and iOS) needs 3 slashes in ‘res:///’ and it works fine in Godot with 3 slashes so i don’t think that’s the problem.

di | 2018-04-22 01:03

Can you elaborate this:

So main scene and auto-load scripts r in ‘res://’(2 slashes) and other resources r in 'res:///"(3 slashes).

If scene1 depends on a resource / scene2 that it is unable to load, scene1 will fail to load (In case it is your main project scene, the game won’t start).

I still think the 3 slashes are causing your issue, could you, just for testing, remove any 3 slashes scene / resource and see if everything else works perfectly ?

GameVisitor | 2018-04-22 05:45

in the log,

Found file: res:///scenes/1F.tscn

.get_current_dir() returns 3 slashes.(i’m only showing this one but all the other resources returns 3 slashes with right casings and extensions.)

 At: res://gm.gdc:131.

and ‘gm.gd’ this is the ‘auto-load script’ and this has 2 slashes.

ERROR: _load: Failed loading resource: res:///Main.tscn

and also i tried setting the main scene with 3 slashes for just in case, then the app didn’t even launch with this err.

i changed all the codes that have load or preload into 2 slashes after u mentioned it.

Found file: res:///scenes/1F.tscn

    ERROR: load_source_code: Condition ' err ' is true. returned: err
   At: modules/gdscript/gdscript.cpp:792.
ERROR: load: Condition ' err != OK ' is true. returned: RES()
   At: modules/gdscript/gdscript.cpp:1856.
ERROR: _load: Failed loading resource: res://Spawn.gd
   At: core/io/resource_loader.cpp:186.
ERROR: poll: res://Spawn.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://Spawn.gd
   At: scene/resources/scene_format_text.cpp:439.
ERROR: load: Condition ' err != OK ' is true. returned: RES()
   At: core/io/resource_loader.cpp:149.
ERROR: _load: Failed loading resource: res://Spawn.tscn
   At: core/io/resource_loader.cpp:186.
ERROR: poll: res://scenes/1F.tscn:22 - Parse Error: [ext_resource] referenced nonexistent resource at: res://Spawn.tscn
   At: scene/resources/scene_format_text.cpp:439.
ERROR: load: Condition ' err != OK ' is true. returned: RES()
   At: core/io/resource_loader.cpp:149.
ERROR: _load: Failed loading resource: res://scenes/1F.tscn
   At: core/io/resource_loader.cpp:186.
ERROR: load: Error loading resource: 'res://scenes/1F.tscn'
   At: core/bind/core_bind.cpp:79.

and now all the resources still have 3 slashes but 7 more errs r added.

di | 2018-04-22 06:06

:bust_in_silhouette: Reply From: di

I think I figured out the problem.
I changed some file name’s casings several times during development and every time I did that I also edited the codes to go along with the changed names.
But the problem was that the scenes and scripts inside other scenes are still looking for their old named original files to get loaded. Since I couldn’t find out how to change or implement new names(or paths), I just manually deleted those scenes and re-added them as children. And also I had to disconnect and reconnect the scripts with new names.
Now it works fine. Usually in other engines, those changes are implemented automatically so I never thought that would be the cause of this problem. But Godot is case insensitive, so it doesn’t recognize as a change if u only change the casing. Such a rookie mistake.

Anyway I really appreciate everyone’s help.

Thank you ! Casing of one of my scene was indeed not the same in file system and in the project, which caused the problem. You solved my case

Gregzenegair | 2019-12-04 19:51