When I create a new resource for a node such as a mesh or a StandardMaterial3D, or collision shape, etc., It doesn’t ask me to give it a name. Likewise if I “make unique” a resource (basically making a copy), I again am not asked for a name.
So where do all these resources go and who is keeping track? Surely they must have some identification so the engine can remember what they are and where they are used. What if I want to reuse one for something else or I want to purge unused resources?
If they don’t have names, how do I know if multiple nodes share the same resource? Often times I would adjust a mesh on one node for example only to realize later that it also changed other ones unintentionally.
You can set (or get) the name with the .name property. Last time I checked, I think each new thing gets named after its type/class/whatever with a number tacked on the end, so if you did something like:
for i in 10: add_child(Button.new())
for ch in get_children(): print(ch)
----
Button
Button1
Button2
Button3
[...]
Node has the name property (Button inherits from Node), but Resource does not. It has resource_name which can be set, but not all resource types support it.
If you want to check if they’re the same in code, you can just do an equals (==) comparison, since they are the same. Otherwise, just save the resources you want to files in the project. Then you will be able to compare the file name.