Use this page to get a clean GridBuilding 5.0.2 setup with the current template workflow.
1) Add the plugin and confirm paths
- Ensure the addon is installed at: res://addons/grid_building
- Keep the 5.0.2 plugin files together; do not mix folders from older plugin snapshots.
- Confirm your project can load 5.0.2 resources (no missing script/resource errors in the editor).
2) Configure systems via the Inspector (Recommended)
In GridBuilding 5.0.2, we prioritize a no-code setup for your level infrastructure. Instead of creating a level script to manually wire systems, you should assign dependencies directly in the Godot Inspector.
The Collector/Injector Pattern
- GBInjectorSystem: Add this to your
Systemsfolder. It acts as the central hub for dependency resolution. - GBCompositionContainer: Create a
.tresresource for your rules and templates. Assign this to thecomposition_containerexport on theGBInjectorSystemin the Inspector. - GBLevelContext: Add a
GBLevelContextnode to your level root. This node should have itstarget_map(your TileMapLayer) andworldreferences assigned in the Inspector. - GBOwner: The entity that “owns” the placement (e.g., the Player) should have a
GBOwnernode.
By assigning these in the editor, the GBInjectorSystem can automatically find and wire them at runtime without a single line of boilerplate code in your MainLevel.gd.
Required Scene Tree
| |
3) Use the Placement UI Template
Don’t put all of your code in a level script. Instead, use the PlacementUITemplate (or a custom UI controller) to trigger building system interactions.
Recommended Architectural Pattern: UI-Driven Interaction
Instead of manually setting states in your level script, connect your UI components to the BuildingSystem. The PlacementUITemplate provides a “Golden Path” implementation for selection and placement triggers.
| |
4) Validated By
We provide a set of “Golden Path” integration tests that match this recommended setup. If your scene matches the structure above, you can use these tests to verify your project integrity.
- Integration Tests: Includes
test_recommended_ui_trigger_flow(see:getting_started_workflow_test.gd) to validate the UI-to-System architectural pattern. - E2E Consistency: Includes
test_injector_auto_wiring(see:all_systems_integration_tests.gd) which confirms thatGBInjectorSystemcorrectly identifies the components.
Cross Test Validation
To verify the setup and initialization steps described in this guide, refer to the following test scripts and source files which demonstrate the correct configuration:
- Scene Setup & Injection:
getting_started_workflow_test.gd - System Entry:
all_systems_integration_tests.gd - Placement Rules:
valid_placement_tile_rule_test.gd
Validation Sources
The following source files in GBInjectorSystem validate the injection behavior described in this guide:
gb_injector_system.gd— Core implementation:_ready()and_initialize(): Trigger automatic injection when composition_container is assignedinject_recursive(): Performs initial scene tree injection_on_child_entered_tree(): Handles runtime node injection via signal callback_validate_after_injection(): Runs automatic validation after injection completes
- API Reference: GBInjectorSystem
Common Issues
Injection Not Running
If injection doesn’t seem to be running, verify that:
- The
GBInjectorSystemnode is in your scene tree - The
composition_containerproperty is assigned (not null) - Nodes that need injection implement
resolve_gb_dependencies(container: GBCompositionContainer)
Validation Errors
If you see validation errors after setup:
- Check that
GBLevelContexthas a validtarget_mapassigned - Verify templates are loaded via
GBConfig.templates - Ensure
GBOwnerexists for the entity doing placement
Next Steps
After completing this setup, proceed to:
- Placement Rules Guide - Configure placement validation rules
- Targeting Flow - Understand cursor targeting
- Troubleshooting - Common issues and solutions