Diagnose Grid Toolkit workflows
When to use
When a workflow fails or a component is not ready, read the result returned by that operation before subscribing to process-wide diagnostics.
Before you start
Keep the failed result, build report, or renderer status. A diagnostic explains a failure; it is not a committed board event or saved gameplay state.
Procedure
| Failure | Read first | Why |
|---|---|---|
| Preview or Apply rejection | Returned GridActionResult and FormatDiagnostics() |
Owns that action's codes, coordinates, and messages. |
| Structure placement rejection | GridStructurePlacementResult | Includes candidate cells and identifies the policy that produced the decision. |
| Authored board will not build | GridAuthoringBuildReport | Owns asset and configuration failures before runtime state is ready. |
| View or renderer is not ready | GridBoardView and renderer status |
Reports binding, layout, capability, and module problems. |
| Process-wide integration fault | GridToolkitDiagnostics.Reported | Reports subscriber, resolver, authoring, and binding faults. |
| Advanced process-local trace | GridToolkitDiagnostics.Observed |
Exposes Experimental observations without changing board state. |
GridToolkitDiagnosticDeliveryMode.LogAndNotify writes to the Unity Console and invokes
Reported. NotifyOnly invokes Reported without the automatic Console entry. Neither mode
buffers action results.
Excerpt — subscribe and restore process-wide diagnostic state. Tested using public APIs.
public void Begin()
{
if (observing)
return;
previousMode = GridToolkitDiagnostics.DeliveryMode;
GridToolkitDiagnostics.DeliveryMode =
GridToolkitDiagnosticDeliveryMode.NotifyOnly;
GridToolkitDiagnostics.Reported += OnReported;
observing = true;
}
public void Dispose()
{
if (!observing)
return;
GridToolkitDiagnostics.Reported -= OnReported;
GridToolkitDiagnostics.DeliveryMode = previousMode;
observing = false;
}
Result
The integration reports the failure through its owning result or status. Optional global subscribers receive process-wide faults, and their owner restores previous delivery settings and unsubscribes during cleanup.
Troubleshooting
| Symptom | Check |
|---|---|
The Console is quiet but Reported fires |
The delivery mode is NotifyOnly. |
| Diagnostics appear twice after reload | Ensure one owner subscribes and unsubscribes each callback. |
| A subscriber throws after a commit | The commit remains valid; fix the observer using the reported diagnostic. |