Long story short, I’ve had an idea to attach a resource to various nodes in my game that sets their health so I can have a universal system. The current issue I’ve run into is that I want to reference a node that has this resource attached to it via metadata.
The only way I’ve found to be able to do this is by adding a signal via code to the node being referenced, but I was hoping to avoid having to add a script to every node that can take damage. Is there a way to generically find out if a node has a resource attached via metadata? And if so, is there a way to then alter the numbers attached to said resource from the script looking for it?
It sounds like it would be a lot easier to simply write one script, and use the class_name keyword so that you can create that same object from within the editor itself.
Thank you for this information. Making my resource script into a script that extends Node3D instead and adding it as a child of nodes with health lets me do exactly what I am looking for.