Godot Scenes, Resources, and Export Workflows
Godot builds games from scenes — trees of nodes saved as reusable files — and Resources, data objects such as textures, materials, and custom data classes that scenes reference. The model is simple and flexible: a player, an enemy, a level, and a menu are all scenes that can be instanced inside other scenes, and gameplay data can live in Resource files editable in the inspector.
The same flexibility creates a few classic problems. Resources are shared by default, so changing one enemy's stats changes every enemy. Save files written carelessly corrupt on crash or become unreadable after an update. And the game behaves differently once exported — paths, file access, platform features, and missing files all change. This page covers structuring scenes and data, saving safely, and exporting reliably.
TL;DR
- Build the game from small, self-contained scenes that communicate through signals; use autoloads sparingly for global services.
- Resources are shared: duplicate them (or use
resource_local_to_scene) for per-instance state. - Use custom Resource classes for designer-editable data, but never load untrusted
.tres/.resfiles — they can contain code. - Save player data to
user://with a version number, write to a temporary file and replace, and migrate old versions. - Export with export presets and the headless CLI in CI; understand PCK files, feature tags, and read-only
res://. - Test exported builds, not only the editor, on every target platform.
Quick Example
A custom Resource for designer-editable data, duplicated per instance so runtime changes do not leak:
Saving and loading versioned JSON in user://, writing to a temporary file first:
Exporting from the command line in CI:
Core Concepts
Scenes, Nodes, and Signals
A scene is a tree of nodes saved to a .tscn file; instancing places one scene inside another, and inherited scenes extend a base scene. Keep scenes small and focused — a player, a weapon, a door — and connect them with signals ("health_changed", "door_opened") rather than reaching into other nodes with long paths, which breaks when trees are rearranged. Groups let you address sets of nodes (all enemies) without hard references.
Autoloads are nodes loaded at startup and available globally — useful for audio managers, save services, and event buses, but they become hidden dependencies if overused.
Resources and Sharing
Custom Resource classes with @export properties give designers inspector-editable data assets — stats, item definitions, wave configurations — that are type-checked and versioned with the project.
Saving Player Data
res:// is the project's read-only resource path in exported games; write player data to user://, which maps to a platform-appropriate user data directory. Options include JSON, ConfigFile for settings, and binary FileAccess formats. Godot's documentation warns that loading Resources from untrusted sources can execute code embedded in them, so prefer plain data formats for save files and anything players can share. Version every save format and migrate step by step; write to a temporary file and replace to avoid corruption on crash. See Game Save Systems and Data Migration.
Exporting
Editor Versus Exported Builds
Common surprises: files not included in the export filter are missing; import artifacts differ by platform; file names are case-sensitive on some platforms; res:// is read-only; editor-only plugins and @tool scripts do not run; and performance differs from the editor. Export and run builds on each platform regularly, ideally from CI, and add smoke tests with frameworks such as GUT or gdUnit4. See Game Builds, Distribution, and Live Operations.
Best Practices
Keep Scenes Small and Loosely Coupled
Compose features from focused scenes connected by signals and groups.
Treat Shared Resources Deliberately
Duplicate resources that hold per-instance state, and keep shared resources read-only at runtime.
Version and Protect Save Data
Use plain data formats, version numbers, migrations, and atomic replacement.
Export Continuously
Run headless exports in CI and test the exported builds, not only the editor.
Common Mistakes
Mutating a Shared Resource
Saving to res://
Loading Player-Shared Resource Files
FAQ
What is the difference between a scene and a Resource in Godot?
A scene is a saved tree of nodes that can be instanced; a Resource is a data object — such as a texture, material, or custom data class — that nodes reference and that can be saved and shared.
Why does changing one object's material change all of them?
Resources loaded from the same file are shared. Duplicate the resource for the instance you change, or mark it local to the scene.
Where should a Godot game save player data?
In user://, which maps to a writable, platform-appropriate user directory. res:// is read-only in exported games.
How do I export a Godot project from CI?
Install matching export templates on the build machine, define export presets in the project, and run Godot headless with --export-release and the preset name.
Is it safe to load .tres files from players?
No. Resource files can contain scripts, so loading untrusted resources can execute code. Use plain data formats for user-generated or shared content.
Related Topics
- Godot — The open source game engine
- Game Save Systems and Data Migration — Durable, versioned saves
- Game Development — Building games
- Game Builds, Distribution, and Live Operations — Shipping builds
- Game Asset Pipelines — Importing and packaging assets
- CI/CD — Automating exports