Sitemap
CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Why You Should Use Godot’s Custom Resources!

Or: Godot’s nice way of defining your own data types :)

4 min readOct 1, 2025

--

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!

Press enter or click to view image in full size
A little scene where I randomly get one of my vehicle data instance — that specifies its name, its speed and its 3D model!

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 = 1

C#

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#:

  1. When creating a custom resource type with a C# class, make sure to name your .cs file exactly the same as your resource class!
  2. To properly register it in your project (after saving your

--

--

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Mina Pêcheux
Mina Pêcheux

Written by Mina Pêcheux

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)

Responses (1)