Synthèse automatique
Ce skill couvre la conception, l'organisation et la transition entre scènes dans Godot 4, y compris la composition de scènes, le chargement asynchrone et additif, et l'instanciation de PackedScene.
Points forts
- Démarche structurée pour concevoir des hiérarchies de scènes maintenables
- Implementation complète des transitions fluides avec AnimationPlayer
- Gestion du chargement asynchrone pour éviter les freeze
- Prise en charge du chargement additif pour superposer des éléments UI ou sous-niveaux
Limites
- Spécifique à Godot 4, non applicable à d'autres moteurs
- Nécessite une connaissance préalable des noeuds et signaux Godot
- Les exemples de code n'incluent pas la gestion des erreurs avancée
Utilisez ce skill pour toute implémentation de transitions de scènes, gestion de niveaux ou création de composants réutilisables dans un projet Godot 4.
Ne l'utilisez pas si vous travaillez avec un autre moteur de jeu ou si votre jeu ne nécessite qu'une seule scène sans besoin de transitions complexes.
Analyse de sécurité
SûrThe skill only contains GDScript code for Godot game development, with no shell commands, network requests, or any destructive actions. It's purely instructional and safe.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
Create a SceneManager autoload in Godot 4 that handles smooth transitions between scenes with fade in/out animations.Implement additive scene loading in Godot 4 to load a mini-map overlay on top of the main level.Set up a spawner in Godot 4 that uses an exported PackedScene variable to instantiate enemy prefabs at random positions.Scene Architecture & Management
Description
This skill covers designing, organizing, and transitioning between scenes in Godot 4. Godot's scene system is its core architecture — understanding scene composition, instancing, and lifecycle management is essential for building maintainable games.
When To Use
- Designing the scene tree hierarchy for a new game
- Implementing scene transitions (level loading, menus)
- Working with additive scene loading
- Creating reusable scene components (prefabs)
- Managing scene lifecycle and cleanup
Prerequisites
- Godot 4.3+ with project structure configured
- Understanding of node types and the scene tree
- GDScript fundamentals (signals,
await)
Instructions
1. Scene Composition
Godot scenes are the building blocks of your game. Think of them as reusable components:
# Good — small, focused scenes
player.tscn → CharacterBody2D + Sprite + Collision + Scripts
enemy_goblin.tscn → CharacterBody2D + AI + Animation
health_bar.tscn → Control + ProgressBar + Label
door.tscn → StaticBody2D + Area2D (trigger) + AnimationPlayer
# Compose them in level scenes
level_01.tscn
├── TileMap
├── Player (instance of player.tscn)
├── Enemies
│ ├── Goblin1 (instance of enemy_goblin.tscn)
│ └── Goblin2 (instance of enemy_goblin.tscn)
├── Objects
│ ├── Door (instance of door.tscn)
│ └── Chest (instance of chest.tscn)
└── UI (instance of hud.tscn)
2. Scene Transitions
Create a SceneManager autoload for smooth transitions:
# scripts/autoload/scene_manager.gd
extends Node
signal transition_started
signal transition_finished
@onready var _animation: AnimationPlayer = $AnimationPlayer
var _next_scene_path: String = ""
func change_scene(path: String) -> void:
transition_started.emit()
_next_scene_path = path
_animation.play("fade_out")
await _animation.animation_finished
get_tree().change_scene_to_file(path)
_animation.play("fade_in")
await _animation.animation_finished
transition_finished.emit()
func reload_current_scene() -> void:
change_scene(get_tree().current_scene.scene_file_path)
3. Async Scene Loading
For large scenes, use threaded loading:
func change_scene_async(path: String) -> void:
transition_started.emit()
ResourceLoader.load_threaded_request(path)
# Show loading screen
var loading_screen := preload("res://scenes/ui/loading_screen.tscn").instantiate()
get_tree().root.add_child(loading_screen)
while true:
var progress: Array = []
var status := ResourceLoader.load_threaded_get_status(path, progress)
loading_screen.update_progress(progress[0])
if status == ResourceLoader.THREAD_LOAD_LOADED:
break
elif status == ResourceLoader.THREAD_LOAD_FAILED:
push_error("Failed to load scene: " + path)
loading_screen.queue_free()
return
await get_tree().process_frame
var scene: PackedScene = ResourceLoader.load_threaded_get(path)
get_tree().change_scene_to_packed(scene)
loading_screen.queue_free()
transition_finished.emit()
4. Additive Scene Loading
Load scenes additively to layer gameplay with UI, overlays, or sub-levels:
var _loaded_scenes: Dictionary = {}
func load_scene_additive(path: String, parent: Node = null) -> Node:
var scene: PackedScene = load(path)
var instance := scene.instantiate()
var target := parent if parent else get_tree().current_scene
target.add_child(instance)
_loaded_scenes[path] = instance
return instance
func unload_scene(path: String) -> void:
if _loaded_scenes.has(path):
_loaded_scenes[path].queue_free()
_loaded_scenes.erase(path)
5. PackedScene as Prefabs
Use PackedScene references for instancing reusable objects:
@export var enemy_scene: PackedScene
@export var spawn_points: Array[Marker2D] = []
func spawn_enemies() -> void:
for point in spawn_points:
var enemy := enemy_scene.instantiate() as CharacterBody2D
enemy.global_position = point.global_position
add_child(enemy)
Best Practices
- Keep scenes small and single-purpose — one scene per logical entity.
- Use scene inheritance for variants (e.g.,
enemy_base.tscn→enemy_goblin.tscn). - Always use a SceneManager autoload — never call
change_scene_to_file()directly. - Use
@export var scene: PackedSceneinstead of hardcodedpreload()paths where possible. - Organize scenes by feature:
scenes/characters/,scenes/ui/,scenes/levels/. - Use
Marker2D/Marker3Dnodes for spawn points and reference positions.
Common Pitfalls
- Monolithic scenes. A single scene with hundreds of nodes is unmaintainable. Break it up.
- Circular scene references. Scene A instances Scene B which instances Scene A. Use signals or autoloads instead.
- Forgetting cleanup. Nodes added with
add_child()must be freed withqueue_free()or they leak. - Blocking the main thread. Use
ResourceLoader.load_threaded_request()for large scenes. - Hardcoded scene paths. Use
@export var scene: PackedScenefor editor-assignable scene references.
Reference
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/scene-architecture-management-in-godot-mma3jsbd/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/scene-architecture-management-in-godot-mma3jsbd' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/scene-architecture-management-in-godot-mma3jsbd/download' --output '.skill-downloads/scene-architecture-management-in-godot-mma3jsbd/SKILL.md.part' && mv '.skill-downloads/scene-architecture-management-in-godot-mma3jsbd/SKILL.md.part' '.skill-downloads/scene-architecture-management-in-godot-mma3jsbd/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Extrait original : Prerequisites
- Godot 4.3+ with project structure configured
- Understanding of node types and the scene tree
- GDScript fundamentals (signals,
await)
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Le fichier ne fournit pas un en-tête name/description exploitable pour cette procédure native. Le téléchargement reste disponible pour lecture ; utilisez le mode manuel ci-dessous.
Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/scene-architecture-management-in-godot-mma3jsbd/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.