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

Cyclic reference not detected #74110

Closed
nobe4 opened this issue Feb 28, 2023 · 2 comments
Closed

Cyclic reference not detected #74110

nobe4 opened this issue Feb 28, 2023 · 2 comments

Comments

@nobe4
Copy link

nobe4 commented Feb 28, 2023

Godot version

v4.0.rc3.official [7e79aea] => v4.0.rc5.official [6296b46]

System information

macOS 13.2.1 (22D68), Vulkan API 1.2.231 - Forward+ - Using Vulkan Device #0: Intel - Intel(R) Iris(TM) Plus Graphics

Issue description

I've been alternating between V4.0rc3 and V4.0rc5 and there seems to be a regression in the last RC.

Project setup

It's a simplified version of a personal project. I've tried to cut as much as possible, and I got the following:

graph LR;

Base-- has -->Player
Player-- has -->Weapon
Turret-- has -->Weapon

Weapon-- print -->Enemy
Enemy-- print -->Map
Map-- preload -->Turret

Loading
  • has means that the left item has a child node: image image
  • print means the the left item's script prints the custom class name of the right item:
    # enemy.gd
    func _ready(): print(Map)
    # weapon.gd
    func _ready(): print(Enemy)
  • preload means the the left item preload the right item scene:
    # map.gd
    var t = preload("res://scripts/turret.tscn")

So, there's clearly a loop in the graph, a combination of has, print and preload. Which I assume is expected to create a loop and break things. My report is not about this.

Report

There's difference between V4.0rc3 and V4.0rc5 when it comes to opening and executing this project.

Opening

With the cyclic dependency

  • V4.0rc3:

    • It opens with an empty "Load Errors" and removes the Weapon scene from the Turret scene (I suspect to resolve the cyclic dependency):
      image

      I add the Weapon in the Turret to match the initial state and above graph before running further test.

  • V4.0rc5: Nothing, it hangs and doesn't display any output, nor errors.

Without cyclic dependency

This is either:

  • removing a has from the loop
  • removing a print from the loop

In this case, both version open correctly.

Running

With the cyclic dependencies.

  • V4.0rc3: It runs with outputs and errors:

    • Output:

      Loading resource: res://scripts/turret.tscn
      Failed loading resource: res://scripts/turret.tscn
      <GDScript#-9223372010363551060>
      
    • Debug/Errors:

      E 0:00:01:0032   load: res://scripts/turret.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://scripts/weapon.tscn
      <C++ Source>   scene/resources/resource_format_text.cpp:490 @ load()
      E 0:00:01:0032   _load: Failed loading resource: res://scripts/turret.tscn. Make sure resources have been imported by opening the project in the editor at least once.
      <C++ Error>    Condition "found" is true. Returning: Ref<Resource>()
      <C++ Source>   core/io/resource_loader.cpp:222 @ _load()
      
  • V4.0rc5: Nothing, it hangs and doesn't display any output, nor errors.

Steps to reproduce

I left the project in an noncyclic state for easier opening.
Uncomment func _ready(): print(Map) from scripts/enemy.gd to get back the cycle.

  • Open and run the project with V4.0rc3: it shows errors
  • Open and run the project with V4.0rc5: it shows nothing and hangs

Minimal reproduction project

Archive.zip

@YuriSizov
Copy link
Contributor

Does the issue manifest itself in RC6 as well?

@nobe4
Copy link
Author

nobe4 commented Feb 28, 2023

@YuriSizov thanks for pointing me to the last RC, I should've checked that first 🤦
The issue seems fixed and doesn't even have the issue of deleting the cyclic node that I saw in RC3.
Thanks a lot! Amazing to see how fast things are fixed ❤️

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

2 participants