Validation: Configuration

Version note: This guide is validated for Grid Building 5.0.8.

The first point of validation in 5.0.8 should be confirmed during the initial project setup. When you enable the plugin:

  1. Go to Project → Project Settings → Plugins and enable the plugin.
  2. In Project → Project Tools, select Set up default import actions.
  3. Check the Output Panel for confirmation that defaults have been successfully added.
  4. Reload the project (Project → Reload Current Project) and check the Input Map to confirm the 15+ actions have been loaded.

2. GBInjectorSystem Validation

GBInjectorSystem is the primary node responsible for wiring dependencies across the scene.

You should call run_validation() on the injector in your setup scene (or manually trigger it in the inspector if supported) to verify:

  • composition_container is assigned.
  • All dependencies can be resolved.
  • Required scene nodes (GBLevelContext, GBOwner, etc.) are reachable.
  • Placed objects have correct collision_layer for targeting (see Troubleshooting).
1
2
3
4
5
@onready var injector: GBInjectorSystem = $Systems/GBInjectorSystem

func _ready() -> void:
    # Triggering validation after assignment
    injector.run_validation()

3. PlacementValidator (Runtime Readiness)

In 5.0.8, PlacementValidator handles the internal evaluation logic. It can be used to manually validate rules against a context if you are not using the standard building system.

Core Validation Classes

  1. PlacementValidator: The main class that orchestrates validation. It takes a list of rules and evaluates them against the current placement context.
  2. ValidationResults: A data container that captures the outcome of validation.
  3. GBConfigurationValidator: Static methods for centralized configuration validation at editor and runtime.

ValidationResults

MemberTypeDescription
is_successful()bool methodTrue if no blocking issues were found.
get_errors()Array[String] methodList of critical errors that prevent operation.
_errorsArray[String] privateInternal storage for errors.

Note: ValidationResults uses method-based access (is_successful(), get_errors()) rather than direct property access. There is no issues or warnings property - use get_errors() for error strings.


Tips

  • Keep configuration validation fast; it runs during entity creation or system startup.
  • Differentiate between Invalid Configuration (developer error, e.g., missing resource) and Invalid Placement (player error, e.g., placing inside a wall).
  • Use ValidationResults to combine results from multiple rules into a single report.
  • Ensure base placement_rules reference external .tres files. Embedded subresources may deserialize as empty in exported builds. See Web Export Guide.