how to use extend to inhertant script in godot 4

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dethland

Kind hard to find documentation for this problem.
In Godot 3 you can use extend “file_path” to inherit a script.
However, Godot 4 are showing some problem:
It said “could not solve super class inheritance”

Please let me know how to do it,
Thank you for your help.

It is not the “extend” problem, but some syntax error in the script which I try to inherit.
So the editor can auto debug the script you try to inherit.

dethland | 2022-03-02 07:39

:bust_in_silhouette: Reply From: dethland

I got the solution. You just need to choose the file to inherit from when creating a new script.

This is not required though. You should be able to choose later by simply modifying the script. The problem you had was probably about the syntax, or an error in the script you want to extend from.
According to 4.0 docs, the syntax did not change from 3.x. Maybe you made a typo. You could always check what the script looks like after you tried using the create dialog and see what went wrong.

Zylann | 2022-03-02 13:38