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

[4.0 beta] Creating PackedScene duplicates its internal children #69856

Open
atngames opened this issue Dec 10, 2022 · 2 comments
Open

[4.0 beta] Creating PackedScene duplicates its internal children #69856

atngames opened this issue Dec 10, 2022 · 2 comments

Comments

@atngames
Copy link
Contributor

atngames commented Dec 10, 2022

Godot version

4.0 beta

System information

linux

Issue description

Hi,
In the editor, I want to create a PackedScene from a branch of my Tree. This branch contains internal children. When I create the scene, its internal children remains but are duplicated with new non internal ones.

Steps to reproduce

Launch the minimal test project below

Create an InternalParent node
Right click on it and make it a Scene
Look at the new scene's tree and at the console output

I could not find how to avoid this behaviour.
Thanks for your help !

Minimal reproduction project

test_duplicate_internals.zip

@KoBeWi
Copy link
Member

KoBeWi commented Dec 10, 2022

Looks the same as #54960, but no idea why this would happen. (that issue is still fixed, so this one might be something related to nodes created from script)

@Rindbee
Copy link
Contributor

Rindbee commented Dec 12, 2022

There is a solution to address this need:

func add_scene_specific_internal_child(node):
	if owner  and (owner.owner  or !scene_file_path.is_empty()):
		return
	add_child(node, false, INTERNAL_MODE_BACK)

Not suitable for inherited scene.

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

3 participants