godotengine / godotengine/godot-docs

Warn about exception on `change_scene_to_packed` when comming back to same `PackedScene`

Open
#9,018 0 comments 1 reaction 0 assignees View on GitHub
area:class reference enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** 4.2.1

**Issue description:** I had a scenario with two scenes, where the 2nd pointed back to the 1st in the sense of an export `PackedScene` variable and an invocation of `get_tree().change_scene_to_packed()` when a button is pressed. I struggled when trying to understand why I was having errors when coming back to the 1st scene from the 2nd; after reading different responses from forums, it seemed to be that when changing to the 2nd scene, the 1st is disposed in the sense that it cannot be used again in `get_tree().change_scene_to_packed(exported_packed_scene)`.

I wonder if the docs for `change_scene_to_packed()` could both warn about this issue and point to other way of changing scenes when there's a cyclic dependency between them. Any ideas?

**URL to the documentation page (if already existing):** https://docs.godotengine.org/en/stable/classes/class_scenetree.html#class-scenetree-method-change-scene-to-packed

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.