The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote


I am trying to understand inheritance better. I've made a script that defines a custom class Item that extends Area2D. But, if I add a node and select Item ( from the dropdown, rather than getting a new, scriptless node, I get a node named Item that has the Item script already attached to it.

This is undesirable to me because any time that I am adding a node, I am going to want to add a script that extends it, rather than overwriting the base class definition. As a workaround, I've been adding an Area2D, attaching a script, and changing the default extends Area2D to extends Item.

Is this the best method? It works fine, but it's a pretty unintuitive workflow. I feel like I'm missing something (especially because none of the tutorials that I've watched on inheriting from custom classes mentions anything like this).

Thank you!!

Godot version 3.5.1
in Engine by (13 points)

1 Answer

+2 votes

Welcome to the club.
Unfortunately this is how it is as of now and there are dozens of feature requests for this exact thing already.

What's even worse is the documentation encourages you to make custom nodes that give you the exact same results.

So until better can be done your work around is currently the best.

by (6,942 points)
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.