Resources are the powerhouse of Godot

Resources in Godot Are Amazing

Resources are the power house of Godot. Nodes get a lot of focus in Godot and for good reason, Most of the engine’s features rely on Nodes. But Nodes Don’t Do anything on their own, Nodes use Data contained in resources to provide Functionality.

Resources are Data Containers and They can hold a huge number of different kinds of Data. It could be an image, a script, Animations. Any property than you can export on a Node like Strings, Integers or Vectors can be exported on a resource.

And on top of all this, You can create your own Resources as well. All you have to do is Create a script, have it extend Resource and give it a name.

Then, once you have defined the parameters you can add it to any script you want to have access to that defined data.

After that, you can go back to the editor, right click on a folder and choose new resource. Then type the name of your resource in the box, give it a name a hit save. Then you can give each field a value. And that’s it, you’ve created a custom resource. But How can you access it?

To do this you can create an export variable in your script of the name of your resource. Or it could just be of type Resource. Then drag the resource on to that export field and that script will now have access to that data.

Sounds great. But what value could this have for your game? Well, depending on what you’re working on, there might be a ton of data for you to store. If it’s an RPG, you have weapons, stats, enemies and drop rates. And these could all be resources that you could create and customize for each situation so you don’t have to redefine them all the time. These things can also be CSV or JSON files as well or some other database Using a Resource can give you amazing utility and they don’t need to parsed in like these other data structures.

They also inherit Object and Resource which mean they can do a lot more that just hold data. They can also Define Methods and Signals.

To me, this really proves that Resources in Godot is Amazing and you can do a great many things to extend the functionality of Godot. Watch the Video Here!

You can check out the FPS Manager System that I’ve Designed with Resources.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *