OPEN Confused about extending

Only if you are creating a custom class in GDExtensions. Scripts, when attached are the custom class, they do require the underlying node follows the same inheritance as the script.


These are two different operations. Change Type only affects the underlying node type, which may affect the script by simply erroring in-game if the new Node type inherits differently from the script’s type. Generally if the node has a script, it’s a bad idea to change it’s type.

Extending a script should create a new script with

extends "res://your_script_file.gd"
# or if a class_name was declared
extends YourClass

The extended script inherits all of the previous script’s members and methods, similar to inheriting a node’s members and methods. You may have to call super() to access overriden functions like _ready() if the function was present on the inherited base script.

If your version of Godot instead only adds class_name YourClass to the extended script, that is a bug, and you should update to the latest stable version.


What are you trying to do specifically? What problem is to be solved by extending? Maybe we can figure out the correct method for your situation.

1 Like