godot-resources
하는 일
이 스킬은 아이템이나 능력치 같은 게임 정보를 코드 대신 Godot 리소스 파일에 저장하는 방법을 보여 줍니다. 스크립트를 다시 쓰지 않고 게임 데이터를 편집하고 싶은 사람을 위한 스킬입니다.
사용하는 경우
- ✓아이템, 능력치 또는 적 설정을 Godot에서 데이터 파일로 저장하고 싶을 때.
- ✓Godot 프로젝트에서 .tres 또는 .res 리소스 파일을 만들어야 할 때.
- ✓런타임에 게임 데이터를 필요할 때 불러오거나 공유 리소스를 안전하게 바꾸고 싶을 때.
스킬 링크
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-resources/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“코드를 쓰지 않고 파일만 편집해서 새 무기를 추가할 수 있도록 내 Godot 게임을 설정해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
편집 가능한 필드를 가진 사용자 정의 리소스 타입을 만드는 방법, 파일로 저장하는 방법, 씬에서 참조하는 방법, 필요할 때 불러오는 방법을 설명합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Godot Resources (4.x)
Model game data as reusable, Inspector-editable Resource objects instead of hard-coded
values, and load/save them as .tres/.res. Targets Godot 4.7.
When to use
- Use when representing items, stats, enemy configs, dialogue lines, or level metadata as
data; authoring
.tresfiles in the Inspector; or loading/saving custom resources.
When not to use: nodes/scene structure → godot-nodes-scenes; saving the player's
runtime progress (engine-agnostic save format/slots) → save-systems; the C# variant of
this pattern → godot-csharp.
Core workflow
- Subclass
Resourcewithclass_nameand@exportfields. It now appears in the "New Resource" dialog and as an@exporttype, editable in the Inspector. - Create instances as
.tresfiles in the FileSystem dock (text, diff-friendly) or.res(binary, smaller/faster). Edit their fields in the Inspector — no code needed. - Reference resources from nodes via
@export var data: ItemResource, or arrays@export var loot: Array[ItemResource]. - Load at runtime with
preload(constant path) orload/ResourceLoader.load(variable path). Use threaded loading for large assets. - Duplicate before mutating a shared resource at runtime, or every node using it changes too (resources are shared references).
- Save generated/edited resources with
ResourceSaver.save.
Patterns
1. A custom data resource
# item.gd
extends Resource
class_name ItemResource
@export var id: StringName = &""
@export var display_name: String = "Item"
@export_multiline var description: String = ""
@export var icon: Texture2D
@export var max_stack: int = 99
@export var value: int = 0
Create sword.tres from this class in the FileSystem dock and fill it in the Inspector.
2. Consume resources from a node
extends Node
@export var starting_items: Array[ItemResource] = [] # drag .tres files in the Inspector
func _ready() -> void:
for item in starting_items:
print("Have: %s (x%d max)" % [item.display_name, item.max_stack])
3. Duplicate before mutating shared data
func give_unique_copy(template: ItemResource) -> ItemResource:
# true = deep: copies nested arrays/dictionaries and *embedded* sub-resources, but
# sub-resources saved in their own .tres stay shared. Use
# template.duplicate_deep(Resource.DEEP_DUPLICATE_ALL) to copy those as well.
var copy: ItemResource = template.duplicate(true)
copy.value += 5 # mutating the copy won't touch the template .tres
return copy
4. Save and load a resource at runtime
func save_config(cfg: Resource) -> void:
ResourceSaver.save(cfg, "user://config.tres") # user:// = writable app data dir
func load_config() -> Resource:
if ResourceLoader.exists("user://config.tres"):
return ResourceLoader.load("user://config.tres")
return null
Pitfalls
- Resources are shared by reference. A single
.tresassigned to many nodes is the same object — mutating it changes all of them (and re-saving the file). Callduplicate(true)for per-instance state. - A deep copy still changes the original's sub-resource →
duplicate(true)only copies sub-resources embedded in the file; one saved as its own.tres(e.g. a sharedstats.tresinsidegoblin.tres) is still the same object. Useduplicate_deep(Resource.DEEP_DUPLICATE_ALL)when those must be copied too. class_namerequired to instance from the editor. Without it the class won't appear in the "New Resource" dialog or as an@exporttype.res://is read-only in exported games. Write runtime data touser://, neverres://.ResourceSaver.savetores://only works in the editor.- Storing nodes in a Resource doesn't serialize them. Resources hold data, not live
scene nodes. Reference scenes via
PackedScene, not node instances. - Cyclic resource references (A holds B holds A) can fail to save/load cleanly — keep data graphs acyclic or use IDs/lookups.
preloadvsload.preloadneeds a constant path and loads with the script;loadaccepts a variable path at runtime. UseResourceLoader.exists()beforeloadto avoid errors on missing files.- Don't put secrets in
.tres— they ship in plain text inside the export.
References
- For threaded/background loading (
load_threaded_request), `
자주 묻는 질문
Godot 리소스란 무엇인가요?
리소스는 파일로 저장할 수 있고 씬 사이에서 공유할 수 있는 데이터 객체입니다.
리소스를 바꾸기 전에 복제하는 이유는 무엇인가요?
리소스는 공유된 참조이므로, 공유 복사본 하나를 바꾸면 그것을 사용하는 모든 곳이 바뀝니다.
플레이어 진행 상황 저장에도 쓸 수 있나요?
그렇지는 않습니다. 플레이어 진행 상황 저장은 별도의 저장 스킬에서 다룹니다.
상세 정보
작성자의 원본 설명
Design data-driven Godot 4.7 games with custom Resource classes: define typed data with class_name + @export, save/load .tres/.res files, instance and duplicate resources, and load on demand with ResourceLoader (incl. threaded loading). Use when modeling items/stats/configs as data in a Godot project, creating .tres resources, or working with custom Resource subclasses and ResourceLoader/ResourceSaver.
인기도
- GitHub 스타
- 6.6k
- 순위
- #13827
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 10. 28.
댓글
- …
이 저장소의 다른 스킬
router
6.6k에이전트가 엔진과 작업 종류를 파악해, 요청에 맞는 게임 개발 스킬을 골라 주도록 돕습니다.
ai-behavior-trees-utility-ai
6.6k에이전트가 적이나 캐릭터가 우선순위와 점수로 행동을 고르는 행동 트리와 유틸리티 AI 시스템을 만들도록 돕습니다.
audio-design
6.6k에이전트에게 게임 오디오 믹싱을 가르칩니다. 버스, 데시벨 음량, 대사 아래에서의 덕킹, 적응형 음악, 효과음 변주를 다룹니다.
camera-systems
6.6k에이전트가 부드럽게 따라가고, 레벨 안에 머물고, 3D에서 회전하거나 둘러볼 수 있는 게임 카메라를 만들도록 돕습니다.