Extending CanvasItem

Godot Version



Im trying to create a custom node using classes, however im having issues creating a class that extends CanvasItem.

class_name Node25D
extends CanvasItem


When trying to add the node to my scene, it does not show up as an option.
If I for example extend from Node2D it does show under Node2D.
I know CanvasItem is an abstract class but I have read posts from a year ago that do mention being able to extend from CanvasItem.

Can you show me where you saw these posts? in c# when i tried to inherit from CanvasItem, it warns that CanvasItem does not have a constructor that takes 0 arguments.

Is there a reason you can’t want to use Node2D?


Hi Shrooms,

Thanks for the reply.

I preferably do not want to use Node2D because I want to reïmplement Node2D in a way that works with a 2.5D environment e.g drawing, position (not a Vector2 but a Vector3) etc.

If I were to use Node2D I would not use half of the properties in Node2D and that seems inefficiënt to me.

Now that a look back on the original post it does mention extending Node2D instead of CanvasItem so I guess its just not possible currently.

if you’re worried about efficiency i would go with c# instead of gdscript. there are many ways to improve performance, such as reusing nodes instead of creating/disposing.