Assign a custom canvas_item shader as default to all create Sprite2D and AnimatedSprite2D

Godot Version

v4.5.1.stable.steam [f62fdbde1]

Question

Hello, I would like to know if its possible to assign a custom shader of type canvas_item to all future create Sprite2D and AnimatedSprite2D so I don’t need to assign it manually every time.

In my opinion, instead of trying to assign this to every new Sprite2D, you should just define / create a custom Sprite2D and AnimatedSprite2D class that inherits Sprite2D and AnimatedSprite2D respectively, mark both your classes with the @tool tag so it runs in the editor, and then simply assign your shader during _init.

1 Like

That works pretty well actually. Thanks :smiley:

1 Like