This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have a scene A-BASE with child B-BASE. I want to inherit A-BASE and change the child to B-DERIVED in the new A-DERIVED. Is it possible?

Godot version 3.4
in Engine by (14 points)
edited by

I don't think you can change the node types (from the child of type BBASE to BDERIVED) in the scene tree of an inherited scene.

Depending on your goal, you might be able to achieve what you want to do by using script inheritance instead of scenes, and dynamically remove and add scripts of the prefered type.

Also, what you could do is have a scene ABASE, then define two inherited scenes, ADERIVED1 that has the child scene BBASE, and ADERIVED2 that has the child scene BDERIVED. Although this proposition might not meet your requirements.

When using script inheritance you loose the adventage of visual editing. And my scenes are more complex than the example in the question, so it will be a lot of code.
As for the second proposal you loose the polymorphism, since ABASE don't have BBASE child. And again you loose the advantage of visual editing, since you have to set all the relevant properties of BBASE children in every derived scene.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.