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

Child node doesn't initially detect the correct parent type when it is overriden in an instanced scene #32221

Open
samdze opened this issue Sep 20, 2019 · 1 comment

Comments

@samdze
Copy link
Contributor

samdze commented Sep 20, 2019

Godot version:
3.1.1.

OS/device including version:
Windows 10 64 bit

Issue description:
I have two C# scripts, Parent.cs and Child.cs, and a scene (let's call it SceneA) as follows:

  • Parent
    • Child (Child.cs)

Then I instance that scene in another one (SceneB), and I add a script to the Parent node:

  • Parent (Parent.cs) -> Instance of SceneA
    • Child (Child.cs)
public class Parent : Node { }
public class Child : Node {
    public override void _Notification(int what) {
        switch(what) {
	    case NotificationParented:
                if(GetParent() is Parent){
                    // Code
                }
		break;
	}
    }
}

When I run SceneA, the code inside this if statement:

if(GetParent() is Parent){
    // Never executed
}

is not executed, and that's expected, but the same happens even if I run SceneB, where the Parent node should be an instance of Parent.cs class.

The code runs correctly if the Parent node inside SceneA has Parent.cs attached in the first place.

Seems like at the time NotificationParented is emitted the instanced scene is yet to be updated with overridden values?

@KoBeWi
Copy link
Member

KoBeWi commented Oct 31, 2020

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

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