unity-performance

unity-performance is a skill for Claude Code, Codex from tianzhiying/Unity-perf. It costs 102 tokens per session (7,482 once invoked), scanned B, original, MIT.

A guide for improving the performance of Unity games and applications, including frame timing, memory use, rendering, loading, and build size.

In plain words
What is it for?
Use it to optimize Unity classes, views, functions, folders, or modules and to check results with profiling and on-device measurements.
Why use it?
It helps locate causes of stutter, low frame rates, excessive garbage collection, overheating, and slow loading instead of changing code without measuring the result.

Skill for Claude CodeCodex

Part of the unity-perf plugin — 3 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tianzhiying/unity-perf/unity-performance
Any agent
npx skills add tianzhiying/Unity-perf --skill unity-performance
Clone the repo
git clone --depth 1 https://github.com/tianzhiying/Unity-perf

Made for: Claude Code, Codex.

Or install unity-perf, the plugin that ships this one along with the rest of its 3 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for unity-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/tianzhiying/unity-perf/unity-performance.svg)](https://agentmods.dev/skills/tianzhiying/unity-perf/unity-performance)
Your own site
<a href="https://agentmods.dev/skills/tianzhiying/unity-perf/unity-performance"><img src="https://agentmods.dev/badge/skills/tianzhiying/unity-perf/unity-performance.svg" alt="Measured on agentmods" height="20"></a>
Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,482 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00102 $0.07482
Opus 5 $0.00051 $0.03741
Sonnet 5 $0.00020 $0.01496
Haiku 4.5 $0.00010 $0.00748

Measured 4d ago against content hash 5d3eb9eaa2af, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

unity-performance scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Unrestricted tool accessmediumExcessive agency

A wildcard tool grant or "run any command" leaves no least-privilege boundary at all.

A checklist cannot exhaust the problem space of real code. Run any code through the six thinking operators below first; use the checklist only as the last step before delivery, to catch omissions.
skills/unity-performance/SKILL.md · 194 lines

How it starts

The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Unity performance optimization

This skill sets the targets, establishes the disciplines, and points at what is easy to miss. The actual optimization ability comes from your own algorithmic repertoire, your understanding of engine internals, and the community practice you know. The reference files are a safety-net sweep before delivery, not a ceiling on what you produce. If every finding in a pass maps to a numbered checklist entry, that usually doesn't mean the code is clean — it means you didn't explore enough.

1. Acceptance criteria

Four non-negotiable targets. Every piece of performance work is accepted against them.

  • Frame budget: 60 FPS means 16.6 ms per frame, 30 FPS means 33.3 ms. Every optimization must answer "where does this frame's time get saved."
  • Zero GC on hot paths: code that runs every frame (Update, LateUpdate, coroutine bodies, UI refreshes, network packet handling) must hit GC Alloc = 0 B/frame. This is a hard standard, not a best effort.
  • Correct algorithmic order: hot-path complexity must match the data scale. O(n²) paired with an n that can grow is a defect unless you produce evidence bounding n.
  • Passes on device: the final measure is measured frame rate, PSS peak, and thermals on the target low-end device — not editor numbers.

2. Five iron rules

Violate any one of them and the optimization is redone.

  1. Measure before you touch. Take evidence with the Profiler (on device + Development Build) before optimizing, and re-measure the same scene after. Changing code on a hunch is forbidden. The only exception is fixing deterministic anti-patterns that are guaranteed wins and need no data.
  2. Measure on the target device. The editor adds its own overhead, and Mono and IL2CPP behave differently. Editor numbers don't count.
  3. Don't change things to show off. Run every change through three applicability questions — can you argue its correctness (give the boundary cases)? How large is the blast radius? Is the readability cost worth it? If it fails, say plainly "the current implementation is good enough."
  4. Optimization must not create new debt. Indexes, lookup tables, and heaps introduced by an algorithmic fix must be pre-allocated, reused, and capped. You may not fix an O(n²) problem by creating a "new dictionary every frame" problem. Accept on both columns: time and GC Alloc.
  5. Verify configuration claims. Whenever a conclusion depends on a compile switch, a macro, or build configuration (whether [Conditional] gets stripped, whether the logging macro is defined, Debug vs Release differences, Scripting Define values), check the project's actual configuration before concluding. Hypothetical claims like "it should get stripped in the release build" are forbidden — the real state of a macro frequently invalidates the premise of an entire analysis.

Read the full file on GitHub · 194 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 194 lines · 102 tokens per session scan B 5d3eb9eaa2af

Subscribe to this mod's changes

unity-performance is a skill published in the GitHub repository tianzhiying/Unity-perf (2 stars, last pushed 1mo ago), licensed MIT. It adds 102 tokens to every session and 7,482 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it B with 1 finding (unrestricted tool access). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.