Custom Health Checks

intermediate feature

Scene Pilot Pro · Features

Custom 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

  1. Copy CustomCheckTemplate.cs to your own Editor scripts folder and rename it.
  2. Remove the #if false guard at the top of the file.
  3. Implement the ISceneCheck interface (see example below).
  4. 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 ISceneCheck from the Kronnect.ScenePilotPro namespace.
  • The class must have a parameterless constructor.
  • CheckId must be unique across all checks (use a prefix like custom.).

Interface Reference

Every custom check implements these members:

MemberTypeDescription
CheckIdstringUnique identifier (e.g., "custom.my_check").
DisplayNamestringName shown in the Health window results.
CategoryCheckCategoryHealth (objects, hierarchy), Materials (shaders, textures), or Meshes (geometry, LODs).
DefaultSeverityCheckSeverityError, Warning, or Info.
FixTierFixTierAutoFixable (shows Fix/Fix All buttons), ReportGuidance (guidance text only), or InfoOnly (display only).
DescriptionstringTooltip text explaining what the check does.
Run(context)IEnumerable<CheckResult>Detection logic. Yield a CheckResult for each finding.
ApplyFix(result, context)boolFix a single issue. Only needed if FixTier is AutoFixable. Return true on success.
ApplyFixAll(results, context)intBatch-fix multiple issues. Return the number of items fixed.

Context Data

The SPPContext object passed to Run provides pre-collected scene data:

PropertyTypeDescription
AllGameObjectsList<GameObject>Every GameObject in all loaded scenes.
AllRenderersList<Renderer>All Renderer components.
AllMeshFiltersList<MeshFilter>All MeshFilter components.
AllLightsList<Light>All Light components.
AllSceneMaterialsDictionary<string, Material>All unique materials referenced by renderers.
AllSceneTexturesDictionary<string, Texture>All unique textures referenced by materials.
PipelineRenderPipelineTypeActive render pipeline (BuiltIn, URP, or HDRP).
SettingsSPPSettingsUser 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?