Validation: Configuration (5.0.3)

This page outlines validation utilities for configuration validation at initialization, checking that settings, resources, and dependencies are properly configured when the scene loads.

1. Editor Configuration Flow

The first point of validation in 5.0.3 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, GBOwnerNode, etc.) are reachable.
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.3, 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. It holds is_successful, issues (errors), and warnings.

ValidationResults

PropertyTypeDescription
is_successfulboolTrue if no blocking issues were found.
issuesArray[String]List of critical errors that prevent operation.
warningsArray[String]List of non-critical observations.

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.