+2 votes

For example
We defined a base_enemy scene including some nodes, implemented some common behaviors in the script.

When it become to define specific enemies, how to share the common script and node from the base_enemy and modify or add some more behaviors.

It seems it can not extends a scene,.

in Engine by (264 points)
recategorized by

It seems it's a request feature requested by many users.
Will it be available in the 3.0 release?

1 Answer

+1 vote

In 2.1.2 you can create a scene that inherits a base one by using Scene -> New inherited scene.
Then you choose the base scene so you can start editing with it as a base (which is the same as having the root being a scene instance with editable children).

by (29,090 points)

Thanks, this is almost what I'm looking for.
The nodes structure is inherited by this way, but the scripts are shared, to make a inherited script, I think it's possible to extends the base script and attached to the inherited scene.

Yeah, you can extend a base script by using extends "res://path/to/script.gd" And then you can set this new script as the script for that new inherited scene.

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.