godot-signals-groups
하는 일
이 스킬은 시그널을 통해 Godot 게임 요소들이 서로 소통하는 방법과, 그룹을 통해 많은 노드를 한 번에 제어하는 방법을 설명합니다. 더 깔끔한 프로젝트 구조를 원하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓플레이어 사망처럼 게임의 한 부분이 다른 부분에 무언가 일어났음을 알려야 할 때.
- ✓한 그룹의 객체 전체를 한 번에 일시 정지하거나 저장하고 싶을 때.
- ✓Godot 프로젝트에서 씬 사이의 직접 연결을 시그널로 바꾸고 있을 때.
스킬 링크
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-signals-groups/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“Godot에서 플레이어가 죽으면 점수 화면과 소리가 서로 직접 연결되지 않고 반응하도록 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
자식 객체가 위로 시그널을 보내는 방법, 다른 객체가 이를 연결하는 방법, 그룹으로 한 번의 호출로 많은 노드에 작업하는 방법을 설명합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Godot Signals & Groups (4.x)
Decouple nodes with the observer pattern (signals) and act on many nodes at once (groups), instead of hard-coding references between scenes. Targets Godot 4.7.
When to use
- Use when a node needs to tell others "something happened" (player died, item picked up, wave cleared) without holding direct references to them.
- Use when you need to address a whole category of nodes at once ("pause all enemies", "save every checkpoint").
When not to use: raw signal syntax basics → godot-gdscript; scene structure
and instancing → godot-nodes-scenes. For cross-scene global events, emit from an
autoload (see godot-nodes-scenes).
Core workflow
- Decide the direction. A child/sub-scene should emit a signal upward; the parent connects to it. This keeps the child reusable and ignorant of who listens.
- Declare typed signals on the emitter;
emit()them when the event occurs. - Connect with a Callable (
sig.connect(_on_sig)), optionally in the editor's Node dock. UseCONNECT_ONE_SHOTfor fire-once,bind()to pass extra context. - Use groups for broadcast: add nodes to a named group, then iterate
get_tree().get_nodes_in_group(...)orcall_group(...). - Disconnect when needed (e.g. before freeing a long-lived listener) and check
is_connected()to avoid duplicate connections.
Patterns
1. Emit upward, connect from the parent
# coin.gd (reusable pickup — knows nothing about the player or HUD)
extends Area2D
signal collected(value: int)
func _on_body_entered(body: Node) -> void:
if body.is_in_group("player"):
collected.emit(10)
queue_free()
# level.gd (the parent wires the coin to game state)
func _ready() -> void:
for coin in get_tree().get_nodes_in_group("coins"):
coin.collected.connect(_on_coin_collected)
func _on_coin_collected(value: int) -> void:
GameState.add_score(value)
2. Connect flags: one-shot and bind extra arguments
func _ready() -> void:
# Fire exactly once, then auto-disconnect.
$Door.opened.connect(_on_door_opened, CONNECT_ONE_SHOT)
# bind() appends arguments supplied at connect time (after the signal's own args).
$RedButton.pressed.connect(_on_button.bind("red"))
func _on_button(color: String) -> void:
print("Pressed the %s button" % color)
3. Groups: broadcast to many nodes
func pause_all_enemies() -> void:
# Call a method on every node in the "enemies" group (no-op if missing).
get_tree().call_group("enemies", "set_paused", true)
func count_enemies() -> int:
return get_tree().get_nodes_in_group("enemies").size()
Add a node to a group from code or via the editor's Node > Groups tab:
func _ready() -> void:
add_to_group("enemies") # remove_from_group("enemies") to leave
4. Await a signal inline
func open_chest() -> void:
$AnimationPlayer.play("open")
await $AnimationPlayer.animation_finished # pause until it emits
spawn_loot()
Pitfalls
- 3.x connect signature is gone.
connect("died", self, "_on_died")→died.connect(_on_died). The target is implied by the Callable. The legacyObject.connect("died", Callable(self, "_on_died"))works but the method-name string form does not. - Duplicate connections fire handlers multiple times. Connecting again in
_ready()after re-adding a node stacks callbacks. Guard withif not sig.is_connected(cb): sig.connect(cb). - Connecting to a freed node errors. Godot removes a connection when the emitter or the Callable's owner is freed, but a lambda belongs to the script that created it — one that captures a node freed later keeps firing and errors. Connect listener methods, or disconnect stored lambdas yourself.
- Groups are global to the SceneTree, not per-scene. Two levels using the same group name share membership. Namespace group names if that matters.
call_groupsilently ignores nodes lacking the method. Typos in the method name fail quietly — prefer a typed signal when the contract matters.- Signal args must match the handlers.
emit()does not validate arguments against thesignaldeclaration; a handler with a different argument count fails with "Method expected N argument(s)" at emit time. Declare typed params and emit exactly those.
References
- For connection flags, deferred c
자주 묻는 질문
시그널이란 무엇인가요?
시그널은 무언가 일어났을 때 노드가 보내는 메시지이며, 다른 노드가 이에 반응할 수 있습니다.
그룹이란 무엇인가요?
그룹은 이름이 붙은 노드 묶음으로, 예를 들어 모든 적처럼 함께 다룰 수 있습니다.
기본 GDScript 문법도 설명하나요?
아니요. 기본 문법은 별도의 GDScript 스킬에서 다룹니다.
상세 정보
작성자의 원본 설명
Build event-driven, decoupled Godot 4.7 gameplay with signals and node groups: declare and emit custom signals, connect with Callables (incl. bind/one-shot), and broadcast to many nodes via groups and call_group. Use when wiring node communication in a Godot project, replacing tight references with signals, emitting/connecting events, or porting 3.x connect("sig", self, "method") code.
인기도
- GitHub 스타
- 6.6k
- 순위
- #13829
- 라이선스
- 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에서 회전하거나 둘러볼 수 있는 게임 카메라를 만들도록 돕습니다.