+4 votes

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.

in Engine by (37 points)

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

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.

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.

3 Answers

+3 votes

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.

by (290 points)

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

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?

0 votes

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 settings -> Run -> Main 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).

by (849 points)

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.

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 ?

in the log,

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

.getcurrentdir() 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.

+1 vote

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.

by (37 points)
edited by

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.