In my project I’m trying to make a node that extends from the physicsbody2d, not any of its children. but once I write: extends physicsbody2d, I can’t find it in the node tree when adding a new node. I’ve tried giving it a class name and an icon and it still doesn’t help. if anyone knows of a way to do this, please let me know, help is appreciated.
extends does not add a node. It simply extends the methods and properties of the node’s class you attached the script to, using code.
If you want to add a node using in code while running the game, you would add it using the add_child method.
# Create a new Label node
var new_label = Label.new()
# Set the name of the Label
new_label.name = "MyLabel"
# Add the Label as a child to the current node
add_child(new_label)
Doesn’t clicking on “Instantiate Child Scene” bring it up?
I see, thank you for your reply. I guess what I am trying to do might actually need to be done outside of GDScript and that’s more than what I want to get into this time around.
When I created it. I just saved a script and made the script extend a node, so I don’t believe I can instantiate a child scene since I never created one. The goal I would like to achieve is to make a custom node that has all the shared properties of the physicsobject2d, but non of the rigidbody or character body elements, so when you click in the scene tree to add a new node, my custom one would appear beside the two mentioned above, not as a child of either.