Skip to content

Script removed from node upon preload scene in cyclic reference. #76641

@saierXP

Description

@saierXP

Godot version

4.0.3.rc1

System information

Windows Vulkan API 1.3.217 - Forward Mobile -AMD Radeon(TM) Vega 8 Graphics

Issue description

bullet.gd

extends Node2D

var player:Player

player.gd

class_name Player
extends Node

func _test():
	var bullet = preload('res://bullet.tscn')

When running the bullet.tscn scene, the following errors will be reported


ERROR: res://bullet.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://bullet.gd
   at: load (scene/resources/resource_format_text.cpp:490)
ERROR: Failed loading resource: res://bullet.tscn. Make sure resources have been imported by opening the project in the editor at least once.
   at: (core/io/resource_loader.cpp:222)
ERROR: Another resource is loaded from path 'res://bullet.tscn' (possible cyclic resource inclusion).
   at: (core/io/resource.cpp:75)

The script will be lost after restarting the editor.

See video:

preload_scene_bug.mp4

BUG found from the PR(godotengine/godot-demo-projects#849) of Calinou in #75039
Other related issues:
I can reproduce the problem again from its MRP #74110.
I'm not sure if it's related to this, but there's some discussion in #68661.

Steps to reproduce

Maybe if you open the project, you will lose the bullet script, please make sure that the bullet is attached to the scene.

  1. Run the bullet scene.
  2. Restart the editor.
  3. The bullet.gd will miss.

Minimal reproduction project

preload_scene_cyclic.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions