.. _doc_resources: Resources ========= Nodes and resources ------------------- Up to this tutorial, we focused on the `Node` class in Godot as that's the one you use to code behavior and most of the engine's features rely on it. There is another datatype that is just as important: `Resource`. *Nodes* give you functionality: they draw sprites, 3D models, simulate physics, arrange user interfaces, etc. **Resources** are **data containers**. They don't do anything on their own: instead, nodes use the data contained in resources. Anything Godot saves or loads from disk is a resource. Be it a scene (a `.tscn` or an `.scn` file), an image, a script... Here are some `Resource` examples: `Texture`, `Mesh _stats = new Godot.Dictionary(); public BotStatsTable() { _stats["GodotBot"] = new BotStats(10); // Creates instance with 10 health. _stats["DifferentBot"] = new BotStats(20); // A different one with 20 health. GD.Print(_stats); } } ``` Instead of just inlining the Dictionary values, one could also, alternatively... 1. Import a table of values from a spreadsheet and generate these key-value pairs, or... 2. Design a visualization within the editor and create a simple plugin that adds it to the Inspector when you open these types of Resources. CurveTables are the same thing, except mapped to an Array of float values or a `Curve` resource object. .. warning:: Beware that resource files (\*.tres/\*.res) will store the path of the script they use in the file. When loaded, they will fetch and load this script as an extension of their type. This means that trying to assign a subclass, i.e. an inner class of a script (such as using the `class` keyword in GDScript) won't work. Godot will not serialize the custom properties on the script subclass properly. In the example below, Godot would load the `Node` script, see that it doesn't extend `Resource`, and then determine that the script failed to load for the Resource object since the types are incompatible. gdscript GDScript ``` extends Node class MyResource: extends Resource export var value = 5 func _ready(): var my_res = MyResource.new() # This will NOT serialize the 'value' property. ResourceSaver.save("res://my_res.tres", my_res) ```