How to manage similar nodes that should stay consistent with only a few certain varying properties?

Godot Version

v4.2.1.stable.mono.official [b09f793f5]


I have several nodes in Godot that I want to be identical in all but a few specific properties. In this case, I have some Button nodes that should have the same style, size, etc. and should only differ in what texture is used for the button’s icon. What is the best way to handle this so that I do not have to manually keep the nodes consistent in all the attributes besides the texture, like basing them all on a template?

Class Inheritance

extends Node
class_name MyBaseClass

#put all identical features and functions

extends MyBaseClass
class_name AClass

#put all unique features and functions and also override mybaseclass functions


You can do this forever

I don’t understand, how does this help me to keep the properties consistent between multiple nodes? I know how to attach scripts and how to make custom node types, and I know that one way to do this might be to create a template node in the scene and add the small variations to copies of that one programmatically in a script, but that is a lot more cumbersome than if I can see the nodes in the editor and manage their unique properties in the inspector.

Oh… I finally realized that I can use scene instancing for this. I right clicked one of my Button nodes, chose “Save Branch as Scene”, and now I can duplicate the node (which is an instance of another scene) and use it as a template exactly how I was thinking.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.