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

Grandchildren Scenes don't inherit scripts #56584

Closed
RCastroAB opened this issue Jan 7, 2022 · 5 comments
Closed

Grandchildren Scenes don't inherit scripts #56584

RCastroAB opened this issue Jan 7, 2022 · 5 comments

Comments

@RCastroAB
Copy link

RCastroAB commented Jan 7, 2022

Godot version

3.4stable

System information

Ubuntu 20.04

Issue description

When creating long chains of inherited scenes in Godot, the information of the script attached is lost for grandchildren and beyond.

Steps to reproduce

Create a scene A, then create an inherited scene B from A. After that create an inherited scene C from B. Now attach a script to A. B will have the script attached but C will not.

Edit: All scenes must be open in the editor.

Minimal reproduction project

InheritanceBug.zip

@kleonc
Copy link
Member

kleonc commented Jan 7, 2022

Steps to reproduce

Create a scene A, then create an inherited scene B from A. After that create an inherited scene C from B. Now attach a script to A. B will have the script attached but C will not.

Can't reproduce (W7, both in 3.4.2.stable and 3.4.stable). C inherts the script just fine.
Edit: I guess I was closing the scenes after creating them. When keeping the scenes open in the editor (after the creation) then I can reproduce it, "B will have the script attached but C will not" indeed.

Minimal reproduction project

InheritanceBug.zip

For some unknown reason in Node2D3.tscn the script is overridden to null:

[gd_scene load_steps=2 format=2]

[ext_resource path="res://Node2D2.tscn" type="PackedScene" id=1]

[node name="Node2D" instance=ExtResource( 1 )]
script = null

Such override haven't appear (automatically from nowhere) when I've tried to recreate the issue.
Edit: it did appear when kept the scenes open.

@RCastroAB
Copy link
Author

Thank you for your reply!

How strange, I just checked and it's generating that line into the file upon running the C scene. Before that, the file is generated as one would expect, and if the line is deleted the script will be attached correctly, but will not update if the script is detached on the parent. I created a new project, this time without running C, so the line shouldn't be there.

Inheritance Bug.zip

I also got this confusing error message somewhere along the way.

 scene/main/node.cpp:1560 - Condition "!common_parent" is true. Returned: NodePath()
 Cannot get path of node as it is not in a scene tree.
 (Node not found: "" (relative to "").)
 editor/editor_data.cpp:1033 - Condition "!p_node->is_inside_tree()" is true.

I have also had a seemingly unrelated issue with child scenes only updating their inherited scripts if the parent scene is loaded in the editor, but I'm unsure whether I to make another issue.

@kleonc
Copy link
Member

kleonc commented Jan 8, 2022

How strange, I just checked and it's generating that line into the file upon running the C scene. Before that, the file is generated as one would expect, and if the line is deleted the script will be attached correctly, but will not update if the script is detached on the parent. I created a new project, this time without running C, so the line shouldn't be there.

Inheritance Bug.zip

I think I must have been closing the scenes after creating them, and the issue is happening only if that grandchild (inheritance-wise) scene is open in the editor. I've edited my previous comment.

Also it seems to happen for any property, it's not script-specific behavior. Try changing position or pause_mode in A (when B and C are open as well), then running A, and you'll see the changes being reflected in B but not in C.

I also got this confusing error message somewhere along the way.

 scene/main/node.cpp:1560 - Condition "!common_parent" is true. Returned: NodePath()
 Cannot get path of node as it is not in a scene tree.
 (Node not found: "" (relative to "").)
 editor/editor_data.cpp:1033 - Condition "!p_node->is_inside_tree()" is true.

I'm not getting any errors so it may be unrelated to this issue. Not sure what could be the cause.

I have also had a seemingly unrelated issue with child scenes only updating their inherited scripts if the parent scene is loaded in the editor, but I'm unsure whether I to make another issue.

Kinda related, kinda not, hard to tell. There are many issues for "inherited scene" reported, you can check them out.

Actually just looked briefly at few of these issues and seems like this issue is a duplicate of #55964.

@RCastroAB
Copy link
Author

Nice to know I wasn't the only one. Should I close this issue, since it's a duplicate, or should I wait until the bugs are fixed?

@Calinou
Copy link
Member

Calinou commented Sep 1, 2022

Duplicate of #7984.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2022
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

4 participants