godotengine / godotengine/godot

Switching back to previously loaded scene fails using load_scene_from_packed

Open
#93,258 11 comments 0 reactions 0 assignees View on GitHub
needs testing topic:editor
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- 4.2 stable

### System information

Godot v4.2.2.stable.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)

Contributor guide

Open the contributing guide

Research direction

Start with the linked minimal reproduction project and inspect its script.gd, exported PackedScene references, and scene transition calls. Reproduce the A → B → A failure with change_scene_to_packed() and compare it with change_scene_to_file(); done means circular transitions work and reopening the project no longer reports broken dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
godot
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.