![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | paintedbox |
Hello!
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 (Item.gd) 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!!