Documentation

Scan and optimize your Unity project from the conversation you're already working in.

Scan and optimize from chat

Once connected, your coding agent can scan → plan → apply → re-scan without opening PerfLint's panels. Keep Unity open; ask for the result you want in chat.

“Use PerfLint to scan this project and apply the supported low-risk batch fixes. Leave trade-offs and asset merges for my review. Re-scan and show what changed and what remains.”

Commit your project first. Batch execution requires Pro. The agent can inspect affected code and check preconditions before applying fixes; its own permission settings still apply.

  • Automatic settings fixes: PerfLint applies supported import/project settings changes and reports fresh scan results.
  • Agent-written code: on either tier, the agent can submit C# or shader edits for compilation verification and automatic rollback on failure. This uses your agent's model, not PerfLint AI credits.

Re-scanning verifies findings, not FPS gains. Runtime sampling and before/after measurements still need the editor workflow; the agent can read saved runtime findings.

More things to ask
  • Inspect first: “Use PerfLint to show the top three issues, with file paths and evidence. Don't change anything yet.”
  • Plan: “Use PerfLint to plan a build-size reduction. Preview changes and separate automatic fixes from trade-offs.”
  • Runtime: “Read PerfLint's saved runtime findings for the current scene. Check the sample's scene and timestamp, then explain the main bottlenecks.”

For code edits, ask the agent to use perflint_apply_verified. For C#, wait for perflint_verify_status; shader edits return their verdict directly. A clean compile still needs gameplay testing.

Connect your agent

Install PerfLint, then connect using Unity 6, Unity CLI, com.unity.pipeline and an open editor. Configure the CLI's MCP server for your client:

unity mcp configure --list
unity mcp configure claude-code --project-path /path/to/YourProject

Replace claude-code with your client from the list and restart its session. An agent with terminal access can also run PerfLint's CLI commands directly.

Gemini CLI and other local MCP clients

If your client is not listed, add a local stdio MCP server with your Unity CLI executable as command and these args:

["mcp", "--project-path", "/path/to/YourProject"]

Use an absolute executable path if unity is not on the client's PATH. See Gemini CLI's MCP setup for its configuration format.

Agent cannot see PerfLint tools

Pin the correct project path and restart the agent session. Unity Settings' MCP integration exposes a different toolset; PerfLint commands use Unity CLI.

If automatic Codex setup is unavailable, use an absolute CLI path in its MCP configuration:

[mcp_servers.unity]
command = "/absolute/path/to/unity"
args = ["mcp", "--project-path", "/path/to/YourProject"]
startup_timeout_sec = 120

Requirements

Unity 2021.3 or newer, including Unity 6. Windows, macOS and Linux editors. Scanning is local, free and requires no account.

Install

Open Window ▸ Package Manager ▸ + ▸ Add package from git URL and paste:

https://github.com/cnxiaom/perflint-unity.git

Append #v1.7.2 to pin that release.

Asset Store: get PerfLint, then import it from Package Manager ▸ My Assets. It installs under Assets/PerfLint.

Install through manifest.json

Add this entry to dependencies in Packages/manifest.json:

"com.perflint.unity": "https://github.com/cnxiaom/perflint-unity.git"

Scan

  1. Open Tools ▸ PerfLint ▸ Scan Project (Ctrl/Cmd + Alt + L).
  2. Click Scan Project. Filter by severity or search for a rule, asset or script.
  3. Read the finding's evidence and recommendation. Use Locate where available to jump to the source.

If prompted, enable script analysis, wait for compilation, then scan again. Use Export CSV or Export Report to share results. See the rule reference for individual checks.

Runtime Profiler

  1. Open Tools ▸ PerfLint ▸ Runtime Profiler (Ctrl/Cmd + Alt + M).
  2. Enter Play Mode, reach the scene you want to measure and let loading settle.
  3. Click Start Sampling, reproduce the workload, then Stop & Analyze.
  4. Wait for hotspot processing, then inspect the findings and use Locate where available.

Deep Profile adds script detail and overhead. Follow any recompile prompts and sample again. Turn it off for representative timing; compare runs with the same profiling settings.

Read the results
  • Frame budget: 60 FPS allows 16.7 ms per frame; 30 FPS allows 33.3 ms. VSync and frame caps can create waiting time, not CPU work.
  • GC allocations: reducing allocations can reduce collection pressure; it does not guarantee higher FPS.
  • Missing counters: unavailable data does not mean zero cost.
  • Saved results: check the scene and timestamp. They are not live readings; the main findings list only includes runtime results eligible for the current scene.
  • Empty or wrong-scene sample: settle into the intended workload and sample again. Confirm performance on the target device before shipping.

Autopilot

Open Tools ▸ PerfLint ▸ Autopilot, then follow the four steps:

  1. Where you are: scan, set target FPS, and choose the Boot from and Measure scenes.
  2. Baseline: measure before editing. Calibration runs automatically; navigate to the target scene if needed and let it load.
  3. This round: review evidence and risk, select fixes, and apply. Wait for imports and compilation to finish.
  4. Did it work: repeat the same scene, camera, workload and settings against the saved baseline.

No measurable change means the difference is within measurement noise. An editor improvement still needs a target-device check.

Baseline or comparison problems
  • No baseline: finish an uncancelled baseline run before applying fixes.
  • Wrong scene: check both scene selectors and reach the measurement scene during Play Mode.
  • Nothing queued: review findings and select applicable fixes in This round.
  • Conditions changed: restore the original workload and settings, or record a new baseline. Do not compare different profiling modes.

Apply fixes

Commit your project first and review each fix's preview and scope.

  • One-click and batch fixes (Pro): apply supported settings changes. Edit ▸ Undo does not restore these; use version control.
  • AI Fix (Free & Pro): generates a focused code edit, verifies compilation and rolls back failed edits.
  • Migration Assistant (Pro): previews a whole-file diff and verifies compilation after applying it.

A clean compile does not prove gameplay is correct. Test the affected behavior after any code change.

AI setup

Hosted: Explain and AI Fix work without an API key. Free includes 10 credits/day; Pro includes 5,000/month.

Your own key (either tier): open LLM ▸ Advanced… and add a Claude or DeepSeek key. Requests go directly to that provider at its rates and do not use PerfLint credits.

CLI & CI

With the editor open and Unity CLI set up:

unity command perflint_scan
unity command perflint_list_findings --domain runtime
unity command perflint_fix --dry_run

The runtime query reads saved measurements; it does not start sampling. Preview fixes before applying them. Applying batch fixes requires Pro.

Command reference

Run unity command for available commands and parameters.

CommandPurpose
perflint_scanScan and return counts by severity.
perflint_list_findingsRead findings; filter by rule, domain or severity.
perflint_gatePass/fail against thresholds.
perflint_optimize_planPlan for --goal build|memory.
perflint_optimize_applyApply the safe tier and re-scan (Pro).
perflint_fixBatch fixes; filter scope or preview with --dry_run (apply: Pro).
perflint_apply_verifiedApply an agent's code edit with compilation verification and rollback on failure.
perflint_verify_statusRead the pending or final verification result.

Batch commands leave trade-offs and asset merges for review in the editor. They do not automatically apply AI fixes.

Headless CI: entry points and flags

Use an activated Unity editor with the project closed. Replace Unity with your executable path. This example uses Bash; -logFile - streams progress to the terminal.

Unity -batchmode -nographics -projectPath . \
  -executeMethod PerfLint.Ci.PerfLintCli.RunGate \
  -perflintMaxCritical 0 \
  -perflintReportHtml perflint-report.html -logFile -

Entry points share the PerfLint.Ci.PerfLintCli. prefix:

Entry pointPurposeExit codes
RunGateScan and check thresholds.0 pass · 1 failed · 2 error
ExportReportExport HTML.0 success · 2 error
RunFixApply low-risk fixes and re-scan.0 success · 2 error · 3 Pro required
FlagPurpose
-perflintMaxCritical NFail above N Criticals. Default: 0.
-perflintMaxWarning NFail above N Warnings. Default: off.
-perflintMinScore NFail below score N. Default: off.
-perflintGateJson <path>Write the verdict as JSON.
-perflintReportHtml <path>Write an HTML report.
-perflintFixJson <path>Write RunFix results as JSON.
-perflintDryRunPreview RunFix without applying.

Gate and report export are free. Pro fix execution uses one seat per runner. Activate with PERFLINT_LICENSE or -perflintLicense <key>; store keys in CI secrets.

GitHub Actions example

Use a self-hosted runner with Unity installed and activated. Set its executable path below.

name: PerfLint health gate
on: [pull_request]
jobs:
  gate:
    runs-on: [self-hosted, unity]
    steps:
      - uses: actions/checkout@v4
      - shell: bash
        env:
          UNITY: /path/to/Unity
        run: |
          "$UNITY" -batchmode -nographics -projectPath . \
            -executeMethod PerfLint.Ci.PerfLintCli.RunGate \
            -perflintMaxCritical 0 \
            -perflintReportHtml perflint-report.html -logFile -
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: perflint-report
          path: perflint-report.html

Activate Pro

Click Free / Pro in the PerfLint toolbar, paste your license key and click Activate. Deactivate on a machine to free its seat.

See plans and pricing for a license.

Privacy

  • Scanning and sampling: local; no project upload.
  • Explain and AI Fix: selected finding metadata or code goes to the configured AI service. Hosted requests use PerfLint's proxy; your own key connects directly.
  • Connected agents: requested findings include asset paths and line numbers and follow your agent's data policy.
  • Licensing: activation and periodic validation contact the license service.

See the privacy policy.