Godot Version
4.7.1
Question
Hello. When I am trying to change scenes from scene “A” to “B” it works but when I wanna go back from “B” to “A” it failes, setting “destination” to null. When main scene is set to “B” the same problem occurs from scene “A”. Any idea why is it happenin? Been fryin my brain on this for 2 days.
There is portal script:
extends Node3D
@export var destination: PackedScene
@onready var portal = $Pedastal/PortalOpen
enum states {open,closed}
var state = states.closed
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
portal.visible = false
portal.monitoring = false
state = states.closed
func open_portal():
portal.visible = true
portal.monitoring = true
state = states.open
func close_portal():
portal.visible = false
portal.monitoring = false
state = states.closed
func _on_portal_open_body_entered(body: Node3D) -> void:
if body.is_in_group("player"):
call_deferred("_change_scene")
func _change_scene() -> void:
print("DESTINATION: ", destination)
print("DESTINATION PATH: ", destination.resource_path if destination else "NULL")
get_tree().change_scene_to_packed(destination)
I would suggest to check both scenes if you assigned correctly
wchc
September 4, 2026, 10:59am
3
This is a known issue with the circular references.
opened 07:45AM - 17 Jun 24 UTC
topic:editor
needs testing
### Tested versions
- 4.2 stable
### System information
Godot v4.2.2.st… able.mono - Ubuntu 24.04 LTS 24.04 - Wayland - Vulkan (Forward+) - integrated Intel(R) HD Graphics 4400 (HSW GT2) () - Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz (4 Threads)
### Issue description
When assigning ```PackedScene```s in the inspector, switching from scene ```A``` to scene ```B``` using ```get_tree().change_scene_to_packed(scene)``` will not let you go from ```B``` back to ```A``` using the same method, with the status not being ```OK``` (instead, 31 or ```ERR_INVALID_PARAMETER``` is returned).
Using ```status = get_tree().change_scene_to_file(scene.resource_path)``` throws an error instead.
Tested using 3 scenes instead of 2, but ```A -> B -> C``` again doesn't let you go back to ```A``` from ```C```
**Also discovered**
*In three scene mode*
When the project is re-opened, none of the three scenes can be opened, with the ```Broken Dependencies``` popup showing up, without any broken dependencies. Opening up any of the other two scenes will also show up the same error pointing to the next scene, the scene specified in the export field. This problem persists until the reference is removed from the resource file through a text editor.
### Steps to reproduce
Project given.
In the ```script.gd``` file, a boolean parameter is provided to switch between using ```change_scene_to_packed()``` and ```change_scene_to_file()```. An exported ```PackedScene``` is provided as the scene to transition to. The main page (first scene) is just to select which scene to start with, and has no other effect. Other 2 (3 scenes available) scenes have their numbers put on buttons to differentiate them. Pressing the button takes you to the next scene (scene 2 back to scene 1).
### Minimal reproduction project (MRP)
[godot_bug_circular_scene.zip](https://github.com/user-attachments/files/15863498/godot_bug_circular_scene.zip)
There is a proposal to have it handled properly:
opened 01:51PM - 24 Jul 23 UTC
topic:core
topic:gdscript
### Describe the project you are working on
I'm working on a game with many cha… racters where the data about their personal lives is stored in resources which need to be accessed from a variety of .tscn files. There are many times different characters need to reference each other e.g. I have an export var which is an array of family members, and all the family members have references to each other.
### Describe the problem or limitation you are having in your project
Godot does not allow circular references in resources in export vars.
I apologise if this is the wrong place to post about this, it seemed the most appropriate to me, as this isn't a bug (it seems intentional), and I would like to see if it's possible/desirable to change this.
### Describe the feature / enhancement and how it helps to overcome the problem or limitation
I'm not understanding the reason why resources can't have circular dependencies. I've looked through the forums and the issues on github and I see several thread about making the editor prevent circular dependencies instead of crashing, but I haven't been able to find an explanation for why this happens in the first place. I'm hoping someone can point me to a discussion thread, or even some of the godot source code
I understood the ref-counted issue, but it seems to have been resolved in [#67714](https://github.com/godotengine/godot/pull/67714),
and I was looking at [68281](https://github.com/godotengine/godot/pull/68281) and I'm not sure if this made it into 4.1.1, or whether this solves my problem...
I would like to try to propose a solution to allow circular dependencies, but I'm hoping someone can help me understand the problem first.
### Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I don't understand the problem well enough to propose a solution, but I wasn't sure where else to post about it because it's not really a bug... it seems intentional.
### If this enhancement will not be used often, can it be worked around with a few lines of script?
there are some hacky work-arounds involving referencing the file-path instead of the resource itself, but this requires you to load the resource to access them, and it doesn't allow you to edit the resource in the editor's inspector
I could also not use resources at all, and instead create my own tool which allows me to edit data and then serialize it for saving, but this is basically recreating Resources just to add support for circular dependency
### Is there a reason why this should be core and not an add-on in the asset library?
Resources are a core component of the engine
Use SceneTree::change_scene_to_file() instead
What do u mean? It wouldnt work from B to A in the first place if it was assigned wrong no?
Yea circular dependency it was
I mean it wasn’t obvious to me sorry, it’s always easier see it then read it.
But you got solution, so that’s all it matters.