Skip to content
Back to skills

Unity Performance

ASecurity

Use when asked for a performance review of a Unity diff, branch, or folder, when hunting frame spikes, GC allocations, memory growth, shader hitches, or build size by reading code, assets, and settings, or when the user names unity-performance. Not for writing or configuring the feature itself (use unity-core or unity-rendering) or for a general code review.

  • 6 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 20, 2026
ai-agentspythongoc++c#bashtestinggitapiperformance

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 15 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add Firzus/agent-skills --skill unity-performance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unity Performance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unity Performance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/firzus-unity-performance/badge)](https://www.skillsdirectory.com/skills/firzus-unity-performance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unity-performance
description: >-
  Use when asked for a performance review of a Unity diff, branch, or folder,
  when hunting frame spikes, GC allocations, memory growth, shader hitches, or
  build size by reading code, assets, and settings, or when the user names
  unity-performance. Not for writing or configuring the feature itself (use
  unity-core or unity-rendering) or for a general code review.
---

# Unity performance review

Load the [`unity-core`](../unity-core/SKILL.md) skill with this one: its
default stack decides what a finding recommends. When it is not installed, say
so and recommend from each rule's Fix alone.

The review has two passes. A script runs every rule mechanically, so no rule
is skipped and the coverage numbers are real; then you read only the hits,
drop false positives, and report what holds. Rule bodies stay in `rules/` and
are read only for the rules that hit.

| Part | Checks | Needs |
| --- | --- | --- |
| `scripts/scan.py` | C#, shaders, USS/UXML, and Unity YAML: regex patterns on the added lines of a diff, ABSENT and MANUAL rules | Python 3.11+, Git for a diff |
| `scripts/editor_audit.cs` | Importer values (texture size, compression, Read/Write, mipmaps, mesh size, audio load type, rigs) and project settings (stripping, C++ configuration, physics, Quality Levels, URP assets), through Editor APIs | An Editor reachable through the Unity CLI and its Pipeline package |

## Run the review

1. **Pick the target.** Review a diff or one folder, not a whole long-lived project: dozens of rules hit at once and the second pass loses precision. A branch review diffs against its base branch (`--diff origin/main`; the script diffs from the merge base, so the base's newer commits are left out); uncommitted work diffs against `HEAD`; a folder uses `--paths Assets/Scripts/Battle`.
2. **Read the project settings file.** `.unity-performance.toml` at the project root names the shipped platforms and the project's exceptions; the next section shows it. Without it, Android, iOS, and Web rules stay in scope, and the report says so.
3. **Run the scan** from the project root, writing the Editor audit outside `Assets/`:

   ```bash
   python <skill>/scripts/scan.py --project . --diff origin/main --editor-audit <temp>/audit.cs
   ```

   Its Markdown output lists pattern hits with the enclosing C# method and its context (`frame`, `init`, `other`, `editor`, `asset`), ABSENT rules with no match in the project, MANUAL rules for the touched file types, and a generated coverage section. Without Python 3.11, say so, read the `rules/*.md` files for the touched file types instead, and report the coverage as manual.
4. **Run the Editor audit** when the scan lists EDITOR rules. Connect as the [`unity-cli`](../unity-cli/SKILL.md) skill describes, including its readiness check, then:

   ```bash
   unity command script eval --file <temp>/audit.cs --result-only --timeout 300 > <temp>/audit.json
   python <skill>/scripts/scan.py --project . --audit-result <temp>/audit.json
   ```

   The audit reads importer and project settings and changes nothing in the project; the second command applies the project's overrides to its findings and prints them by level. Without a reachable Editor, list the EDITOR rules as not checked in the coverage.
5. **Confirm each hit.** Read the rule in `rules/<file>` and the code around the hit, then keep or drop it. A `frame` rule hit in an `other` context binds only when a per-frame path calls that method: follow the callers. Hits in `init` arrive already lowered to Info.
6. **Settle ABSENT and MANUAL rules.** Read each listed rule and decide from the project whether it applies; most MANUAL rules apply only when the change does what they describe.
7. **Flag what needs a measurement.** A suspicion that static reading cannot settle goes in the report as "profile recommended", with the symptom to look for from [references/diagnosis.md](./references/diagnosis.md).

Before a release, also run Project Auditor as
[workflow.md](../unity-core/workflow.md#testing) describes; this review does
not replace it.

## Project settings file

```toml
# .unity-performance.toml, at the Unity project root
platforms = ["android", "ios", "desktop"]   # android, ios, web, desktop
# urp = true            # overrides detection from Packages/manifest.json
# addressables = true
# vat = false

[thresholds]            # used by the Editor audit
max_texture_size = 2048
max_mesh_vertices = 65535
long_audio_seconds = 10.0

[[override]]
rule = "AS02"
paths = ["Assets/UI/Gradients/**"]   # optional globs
# context = "frame"     # optional: frame, init, other, editor, asset
level = "Skip"          # Warning, Info, or Skip; an override only lowers a level
reason = "Gradients band when compressed; kept uncompressed on purpose"
```

When the user accepts an intentional finding, such as a texture kept
uncompressed on purpose, record it as an override with its path and reason
rather than repeating it in every review.

## Report

```markdown
## Unity performance review

### Critical
- `path:line` Finding [RULE-ID]
  - Evidence: why it costs, with the rule's measured value
  - Fix: what to do, linking the guidance

### Warning
### Info
### Profile recommended

### Coverage
- (the scan's generated coverage, copied verbatim)
- Editor audit: run, N finding(s) / not run (why)
- Hits confirmed: N; dropped as false positives: N (IDs)
```

Every finding carries its rule ID, so a false positive points at the pattern to
fix. Report only performance: style and design belong to other reviews.

## Maintain the rules

Add or change a rule as [references/rule-format.md](./references/rule-format.md)
describes, then run `python scripts/scan.py --lint`. A rule that disagrees with
the team's practice is a rule to fix, not a finding to argue: adjust its
pattern, level, or reason. The rules derive from CyberAgent's MIT-licensed
skill; see [NOTICE.md](./NOTICE.md).

Files in this skill

  • NOTICE.md1.8 KB
  • SKILL.md5.8 KB
  • references/diagnosis.md14.6 KB
  • references/rule-format.md2.7 KB
  • rules/animation.md10.2 KB
  • rules/assets.md12.6 KB
  • rules/build.md13.7 KB
  • rules/lifetimes.md6.8 KB
  • rules/physics.md7.3 KB
  • rules/rendering.md23.3 KB
  • rules/scripting.md15.3 KB
  • rules/shaders.md7.3 KB
  • rules/ui.md5.2 KB
  • scripts/editor_audit.cs11.2 KB
  • scripts/scan.py32.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.