Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse Error: [ext_resource] referenced non-loaded resource when loading a specific scene #64330

Open
Tracked by #80877
timshannon opened this issue Aug 12, 2022 · 17 comments

Comments

@timshannon
Copy link

Godot version

v4.0.alpha.mono.custom_build [67d4015]

System information

Ubuntu 22.04

Issue description

See the attached project for the scene in question. You get this error when trying to load it:

  scene/resources/resource_format_text.cpp:177 - res://SlidingDoor/SlidingDoor.tscn:8 - Parse Error: [ext_resource] referenced non-loaded resource at: res://SlidingDoor/SlidingDoor.tscn
  scene/resources/resource_format_text.cpp:610 - res://SlidingDoor/SlidingDoor.tscn:8 - Parse Error: [ext_resource] referenced non-loaded resource at: res://SlidingDoor/SlidingDoor.tscn
  Failed loading resource: res://SlidingDoor/SlidingDoor.tscn. Make sure resources have been imported by opening the project in the editor at least once.
  editor/editor_data.cpp:530 - Index p_idx = 1 is out of bounds (edited_scene.size() = 1).

Steps to reproduce

Simply open the attached project. The default scene fails to load.

When you re-import the blend file referenced in the SlidingDoor.tscn file the scene will load fine, until you save the scene which breaks it again. You can keep going round and round like that.

I believe it has something to do with this particular blend file, but I have yet to figure out what specifically is causing the issue. Also I had this issue on previous GD4 commits, but it went away and came back again, so I think a fix may have been reverted recently. If I find the commit where it broke, I'll update this issue.

Minimal reproduction project

Bug.zip

@timshannon
Copy link
Author

Same behavior happens in all alpha versions back through to alpha 9, so it maybe that this is a blender issue, as I've gone through a few version updates in blender since then as well.

Still investigating.

@timshannon
Copy link
Author

I've removed everything from the blend file and replaced it with just a cube, and this issue still happens.

There is also no difference in the .tscn file when it can be opened and when it can't. It's literally the same text:

[gd_scene load_steps=2 format=3 uid="uid://c7pdpypbs85g5"]

[ext_resource type="PackedScene" uid="uid://c7pdpypbs85g5" path="res://SlidingDoor/SlidingDoor.blend" id="1_n726j"]

[node name="SlidingDoor" instance=ExtResource("1_n726j")]

@timshannon
Copy link
Author

Completely removed the .import and .godot folders, still same behavior. Not sure what I'm missing.

@timshannon
Copy link
Author

Also, FYI, the same behavior happens when you reopen the editor. So the scene is fine until you restart the editor, then it's broken again. So re-saving the scene or reopening the editor breaks it, and reimporting the blend file fixes it.

@MikeSchulze
Copy link

is related to #68661

@iglonator
Copy link

iglonator commented Mar 15, 2023

I think I have the same error:

scene/resources/resource_format_text.cpp:174 - res://enemy.tscn:12 - Parse Error: [ext_resource] referenced non-loaded resource at: res://enemy.gd

I have to attach the script at every startup manually, because it's detached. Hopefully this helps to resolve the problem.

@rklassen
Copy link

having same issue

1 similar comment
@tjw123hh
Copy link

having same issue

@Telsanyr
Copy link

Having the same issue here:

  1. I was working on Godot, everything was fine, I could run my project, no error.
  2. I did save my project in this state (git commit), before closing Godot
  3. I closed Godot window
  4. When i re-opened Godot, my GDScript was not attached to my scene anymore and had this error :

load: res://test-scenes/board/DebugTiles.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://test-scenes/board/DebugTiles.gd

But, when checking git, I see no modification since my last commit. The only files that I don't track with git are *.import files and .godot/ files

  1. If I re-attach the script, the scene file is modified (git diff):

-[ext_resource type="Script" path="res://test-scenes/board/DebugTiles.gd" id="1_ys036"]
+[ext_resource type="Script" path="res://test-scenes/board/DebugTiles.gd" id="1_bq1rw"]

[node name="DebugTiles" type="Node3D"]
-script = ExtResource("1_ys036")
+script = ExtResource("1_bq1rw")

If that can help.

@SimonPiCarter
Copy link

I have the exact same issue, for what it worth renaming the file to another name solved the issue.

@heppocogne
Copy link
Contributor

@Telsanyr I had a similar issue and solved by using .scn instead of .tscn.

@Zireael07
Copy link
Contributor

If renaming the file solves the problem, that would mean it's some sort of a cache problem...

@Necronomicron
Copy link

Necronomicron commented May 18, 2023

Just encountered this.
v4.1.dev2.official [668cf3c]
preload() is what causing this in my case.
#76641

@nongvantinh
Copy link
Contributor

It happened to me today. I was feeling lazy to duplicate and rename things in the editor, so I opened the Windows Explorer and duplicated resources, renaming them there. Then, when I switched back to the editor, this error occurred.

Does anyone else edit resources outside the editor like I do? This is very likely one of the issues I had fixed for C# scripts in the past.

@njdf18
Copy link

njdf18 commented Apr 4, 2024

I encountered this problem today. I have a node to transfer a player when it is touched. This node has an exported variable to let me drag a scene file into the inspector.
I noticed this error and tried to fix it by reloading the editor, and all of my scenes became broken (error while loading even if there's no resource lost).
The solution I found is to edit your scene and remove all external scene references that are possible to cause the issue.

@chexmo
Copy link

chexmo commented Apr 18, 2024

I add up to @njdf18 with a similar use case... (using Godot 4.2.1.stable)
image

EDIT:
I'll offer an example of one of my projects
https://gitlab.com/rarodigma-studio/aleph/-/tree/PUBLIC/packed-scene-bug

@chexmo
Copy link

chexmo commented Apr 18, 2024

As an update... it seems like the error has something to do with the fact of coding several references in different scripts that points to the same scene...

As a workaround, having a singleton that contains the references work
https://gitlab.com/rarodigma-studio/aleph/-/tree/PUBLIC/packed-scene-bug-workaround

However, it stills feel like a quick workaround... the benefit of using @Export is clearly better, I don't think it's a expected behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests