Member-only story
Why You Should Use Godot’s Custom Resources!
Or: Godot’s nice way of defining your own data types :)
Need to store character stats, item properties, enemy behaviors or quest data? Custom resources let you define your own structured data types right inside Godot! Like built-in resources (e.g. textures, sounds…), but unique to your game. Plus, you can edit them directly in the inspector!
Godot allows you to create your own data types as resource classes: just inherit from the Resource type and register your class in the project (with class_name in GDScript, or the [GlobalClass] attribute in C#) to get a brand new instantiable resource type!
GDScript
class_name GameData
extends Resource
@export var player_name: String = ''
@export var coins: int = 0
@export var level: int = 1C#
using Godot;
[GlobalClass]
public partial class GameData : Resource {
[Export] public string playerName = "";
[Export] public int coins = 0;
[Export] public int level = 1;
}Important notes for C#:
- When creating a custom resource type with a C# class, make sure to name your
.csfile exactly the same as your resource class! - To properly register it in your project (after saving your…

