Custom Health Checks
intermediate featureCustom Health Checks
You can create your own health checks that integrate with the Health window scanner. Scene Pilot Pro includes a CustomCheckTemplate.cs template in the Editor/Checks folder. Custom checks are discovered automatically via reflection - no registration code needed.
How to Create a Custom Check
- Copy
CustomCheckTemplate.csto your own Editor scripts folder and rename it. - Remove the
#if falseguard at the top of the file. - Implement the
ISceneCheckinterface (see example below). - Your check will appear in the Health window automatically on the next scan.
Requirements
- The script must be in an Editor folder or an Editor-only assembly.
- The class must implement
ISceneCheckfrom theKronnect.ScenePilotPronamespace. - The class must have a parameterless constructor.
CheckIdmust be unique across all checks (use a prefix likecustom.).
Interface Reference
Every custom check implements these members:
| Member | Type | Description |
|---|---|---|
CheckId | string | Unique identifier (e.g., "custom.my_check"). |
DisplayName | string | Name shown in the Health window results. |
Category | CheckCategory | Health (objects, hierarchy), Materials (shaders, textures), or Meshes (geometry, LODs). |
DefaultSeverity | CheckSeverity | Error, Warning, or Info. |
FixTier | FixTier | AutoFixable (shows Fix/Fix All buttons), ReportGuidance (guidance text only), or InfoOnly (display only). |
Description | string | Tooltip text explaining what the check does. |
Run(context) | IEnumerable<CheckResult> | Detection logic. Yield a CheckResult for each finding. |
ApplyFix(result, context) | bool | Fix a single issue. Only needed if FixTier is AutoFixable. Return true on success. |
ApplyFixAll(results, context) | int | Batch-fix multiple issues. Return the number of items fixed. |
Context Data
The SPPContext object passed to Run provides pre-collected scene data:
| Property | Type | Description |
|---|---|---|
AllGameObjects | List<GameObject> | Every GameObject in all loaded scenes. |
AllRenderers | List<Renderer> | All Renderer components. |
AllMeshFilters | List<MeshFilter> | All MeshFilter components. |
AllLights | List<Light> | All Light components. |
AllSceneMaterials | Dictionary<string, Material> | All unique materials referenced by renderers. |
AllSceneTextures | Dictionary<string, Texture> | All unique textures referenced by materials. |
Pipeline | RenderPipelineType | Active render pipeline (BuiltIn, URP, or HDRP). |
Settings | SPPSettings | User configuration (thresholds, disabled checks, etc.). |
Example
using System.Collections.Generic;
using UnityEngine;
using Kronnect.ScenePilotPro;
public class MyCustomCheck : ISceneCheck
{
public string CheckId => "custom.my_check";
public string DisplayName => "My Custom Check";
public CheckCategory Category => CheckCategory.Health;
public CheckSeverity DefaultSeverity => CheckSeverity.Warning;
public FixTier FixTier => FixTier.ReportGuidance;
public string Description => "Describe what this check does.";
public IEnumerable<CheckResult> Run(SPPContext context)
{
foreach (GameObject go in context.AllGameObjects)
{
if (go == null) continue;
bool hasIssue = false; // Replace with your condition
if (hasIssue)
{
yield return new CheckResult(
CheckId, DefaultSeverity, FixTier,
"Issue found on '" + go.name + "'.", go)
{
DisplayName = DisplayName,
Guidance = "Explain how to resolve this issue."
};
}
}
}
public bool ApplyFix(CheckResult result, SPPContext context)
{
return false; // Implement if FixTier is AutoFixable
}
public int ApplyFixAll(IList<CheckResult> results, SPPContext context)
{
return 0; // Return number of items fixed
}
}
Tip: For a complete list of every built-in health check, including severity levels and auto-fix capabilities, see the Health Checks Reference.
Was this page helpful?
Suggest an improvement
Help us improve this documentation page.