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

Loading a parent scene then a child scene with ResourceLoader.load_interactive(...) causes "'res://Parent.tscn' is already being loaded. Cyclic reference?" #50006

Open
31 opened this issue Jun 29, 2021 · 0 comments
Milestone

Comments

@31
Copy link
Contributor

31 commented Jun 29, 2021

Godot version

3.3.2.stable

System information

Windows 10

Issue description

I set up three scenes:

  • Parent.tscn
  • Child.tscn inherits from Parent.tscn
  • Spatial.tscn has a script that loads Parent, then loads Child:
	print(ResourceLoader.has_cached("res://Parent.tscn")) # False
	loaderP = ResourceLoader.load_interactive("res://Parent.tscn")
	loaderP.wait()
	print(ResourceLoader.has_cached("res://Parent.tscn")) # True
	loaderC = ResourceLoader.load_interactive("res://Child.tscn")
	loaderC.wait()

Obviously this isn't how you'd usually use this API, but it reproduces the error just fine. 😄 This was originally spotted in the wild with a typical use of .poll().

When I run with Spatial.tscn as the main scene, I get this output:

False
True
ERROR: Resource: 'res://Parent.tscn' is already being loaded. Cyclic reference?
   At: core/io/resource_loader.cpp:353
ERROR: poll: res://Child.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://Parent.tscn
   At: scene/resources/resource_format_text.cpp:440

It seems to me that when you use ResourceLoader.load_interactive, it doesn't end up calling ResourceLoader::_remove_from_loading_map, so it thinks that res://Parent.tscn is always being loaded from that point on.

It's the first ResourceLoader.load_interactive that seems to be the issue here--using load for the child still causes errors:

	loaderP = ResourceLoader.load_interactive("res://Parent.tscn")
	loaderP.wait()
	loaderC = ResourceLoader.load("res://Child.tscn")

Steps to reproduce

Run the main scene in the repro project or follow the steps in the description.

Minimal reproduction project

GodotLoadInteractiveInherit.zip

@31 31 changed the title Loading a parent scene then a child scene with ResourceLoader.load_interactive(...) Loading a parent scene then a child scene with ResourceLoader.load_interactive(...) causes "'res://Parent.tscn' is already being loaded. Cyclic reference?" Jun 29, 2021
@Calinou Calinou added this to the 3.4 milestone Jun 29, 2021
@akien-mga akien-mga modified the milestones: 3.4, 3.5 Nov 8, 2021
@KoBeWi KoBeWi modified the milestones: 3.5, 3.x Apr 23, 2024
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

4 participants