Migration Guide v5.0.0
Overview
Section titled “Overview”This page contains a concise, practical migration checklist and rationale for upgrading to v5.0.0 from 4.x (tested from 4.4.x and compatible with 4.5.x). For full API changes and details, see the Breaking Changes page.
Summary:
- Save existing settings/resources to disk (.tres/.res) so they can be reused in the new
GBConfig. - Placeable resources (placeable items, meshes, visuals) do not require modification — they continue to work as placeables.
- Add a
GBInjectorSystemnode to the gameplay scene that needs grid-building features and assign aGBCompositionContainerto it (use provided templates where possible). - Create a
GBCompositionContainerresource, nest aGBConfig, and reassign your saved resource files into the new config.
Prerequisites
Section titled “Prerequisites”- Godot 4.4.x or later (4.5 compatible). v5.0.0 depends on APIs introduced in Godot 4.4+.
- A copy of your current project where you can export/save settings resources.
Step 1 — Export & save your existing settings resources
Section titled “Step 1 — Export & save your existing settings resources”Before upgrading your project files or replacing plugin code, save any configuration, template, or exported resources you currently use into .tres / .res files in your project. Typical resources to save:
- Visual templates, indicator materials, and scene fragments used by placement systems.
- Any exported configuration objects that were previously stored as exported properties on nodes (e.g., action sets, placement templates, visual presets).
Why: v5 centralizes configuration in GBConfig and removes many per-node exported properties. Saving to .tres/.res ensures you can reassign these resources to the new config instead of losing them.
Example (editor)
- Select the node/resource that holds the configuration in the editor.
- Convert or
Save Asthe resource tores://data/gb_saved_my_settings.tres.
Note: You do not need to change your placeable resources (the objects you place/move). These remain compatible.
Step 2 — Upgrade plugin and runtime (install v5.0.0)
Section titled “Step 2 — Upgrade plugin and runtime (install v5.0.0)”- Update the plugin to
v5.0.0and restart the editor. Follow your usual plugin update workflow. - Confirm Godot version compatibility (see Prerequisites above).
Step 3 — Add GBInjectorSystem to your gameplay scene
Section titled “Step 3 — Add GBInjectorSystem to your gameplay scene”Recommended approach:
- Pick the gameplay or player-root scene where grid-building will run (the scene that is active when players build/place objects).
- Add a
GBInjectorSystemnode to that scene. - Create or use a
GBCompositionContainerresource and assign it to theGBInjectorSystem’s exportedcomposition_containerproperty.
Tip: the plugin ships with composition container templates under the plugin templates folder. Use the supplied template if you want a tested starting stack of systems and resources.
Why: This keeps injection local to gameplay runtime contexts and prevents embedding injector state inside level resource files.
See: ../api/GBInjectorSystem/ and ../api/GBCompositionContainer/ for properties and usage.
Step 4 — Create GBCompositionContainer + nested GBConfig and reassign saved resources
Section titled “Step 4 — Create GBCompositionContainer + nested GBConfig and reassign saved resources”- Create a
GBCompositionContainerresource in your project (e.g.,res://data/gb_container.tres). - Inside the container, create a
GBConfigresource and assign it to the container’sconfigproperty. - Reapply the
.tres/.resresources you saved in Step 1 into the newGBConfigfields (templates, visuals, action sets, etc.).
Notes and caveats:
- Some resource names or field names may have changed between v4 and v5. If a saved resource does not map directly into a field, you may need to create a new nested resource and copy settings over manually.
- The DI composition will distribute these settings to systems, nodes, and subcomponents at runtime, reducing the need to wire many exported fields across the scene.
See: ../api/GBConfig/ for the config structure.
Step 5 — Ensure GBOwnerContext and a GBOwner are available at runtime
Section titled “Step 5 — Ensure GBOwnerContext and a GBOwner are available at runtime”- The
GBOwnerContextAPI changed: you must set aGBOwnerinstance viaGBOwnerContext.set_owner(...)so systems know who is controlling system operations. Typically this will be the player node or a dedicated owner object created for simulation. - Ensure you create and register a
GBOwnerresource/object and assign it into the container or the level context so systems can acquire the owner from theGBOwnerContextor via injector wiring.
See: ../api/GBOwnerContext/ and ../api/GBOwner/.
Step 6 — Smoke test and validation
Section titled “Step 6 — Smoke test and validation”- Launch your gameplay scene with the new injector and composition container instantiated.
- Run the plugin’s validation: call
validate()on major systems and inspectget_runtime_issues()/get_editor_issues()to find migration problems. - Inspect logs via the container-provided logger (
composition_container.get_logger()/../api/GBLogger/).
Example: call validation from a world script (on ready)
extends Node
@export var injector: GBInjectorSystem
func _ready(): if injector: # run_validation() will log any issues via the container's logger var ok := injector.run_validation() if not ok: push_warning("GB validation returned issues — check logs") else: push_warning("No GBInjectorSystem assigned to world script; skipping validation")Concrete validation examples
Section titled “Concrete validation examples”Here are a few short, real-world examples (taken from test helpers and demos) showing how host projects and tests inspect validation issues. These are intentionally small — adapt them into your game or test harness.
- Inspect and log issues directly from the injector:
var issues: Array[String] = injector.get_runtime_issues()if issues.size() > 0: for issue in issues: push_warning(issue)- Aggregate issues from multiple systems (useful in test harnesses or smoke tests):
var issues: Array[String] = []issues.append_array(injector.get_runtime_issues())issues.append_array(grid_targeting_system.get_runtime_issues())issues.append_array(building_system.get_runtime_issues())if issues.size() > 0: for issue in issues: push_warning(issue)- Inspect specific container-scoped state (example: targeting state from the composition container):
var targeting_issues := composition_container.get_targeting_state().get_runtime_issues()if targeting_issues.size(): for t in targeting_issues: push_warning(t)If you find missing configurations, re-open your GBConfig resource and add or rewire any nested resources. Some names may have changed — check the Breaking Changes page for common signature/rename notes.
FAQ / common pitfalls
Section titled “FAQ / common pitfalls”-
Q: Do I need to change placeable objects (items I place in levels)?
- A: No — placeable resources remain compatible. The migration focuses on configuration + wiring.
-
Q: What if a resource I saved doesn’t fit the new config fields?
- A: Some fields were renamed or moved; create a new nested resource in the
GBConfigand copy values across. The DI system will then distribute them to the necessary systems.
- A: Some fields were renamed or moved; create a new nested resource in the
-
Q: Where should I add the injector node — level scene or gameplay scene?
- A: Add the
GBInjectorSystemto your gameplay/active scene (where runtime player actions occur). Avoid embedding injector state in static level resource files.
- A: Add the
References
Section titled “References”- Breaking changes:
../guides/breaking-changes/ - API pages (v5.0.0):
../api/
If you want, I can:
- Create a
project_docs/migration_v5_upgrade.mdwith copy/paste checklist and editor actions. - Add a small compatibility note page for renamed classes (e.g.,
DragBuildManager→DragManager) undermigration/.