unity-optimizer

unity-optimizer is an agent for Claude Code from XeldarAlz/everything-claude-unity. It costs 46 tokens per session (1,106 once invoked), scanned A, original, MIT.

A Unity performance agent that measures frame timing, memory use, rendering workload, and related statistics, then identifies and fixes bottlenecks. A bottleneck is the part of a game that limits its speed or responsiveness.

In plain words
What is it for?
Use it to investigate CPU or GPU limits, draw calls, overdraw, expensive shaders, memory-heavy assets, object pooling, and allocations during gameplay.
Why use it?
It replaces guesswork with measurements when a Unity game has slow frames, memory problems, excessive rendering work, or garbage-collection pauses.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is ./scripts/validate-code-quality.sh.

Part of the everything-claude-unity plugin — 42 skills, 27 commands, 20 agents, 5 hooks shipped together

Good fit Use it to investigate CPU or GPU limits, draw calls, overdraw, expensive shaders, memory-heavy assets, object pooling, and allocations during gameplay.

Compare 6 agents from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/XeldarAlz/everything-claude-unity
agentmods
npx agentmods add agents/xeldaralz/everything-claude-unity/unity-optimizer

Made for: Claude Code.

Or install everything-claude-unity, the plugin that ships this one along with the rest of its 42 skills, 27 commands, 20 agents, 5 hooks.

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-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/xeldaralz/everything-claude-unity/unity-optimizer/github.svg)](https://agentmods.dev/agents/xeldaralz/everything-claude-unity/unity-optimizer)
Your own site
<a href="https://agentmods.dev/agents/xeldaralz/everything-claude-unity/unity-optimizer"><img src="https://agentmods.dev/badge/agents/xeldaralz/everything-claude-unity/unity-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for unity-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/agents/xeldaralz/everything-claude-unity/unity-optimizer"><img src="https://agentmods.dev/badge/agents/xeldaralz/everything-claude-unity/unity-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,106 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00046 $0.01106
Opus 5.5 $0.00018 $0.00442
Sonnet 5.5 $0.00009 $0.00221
Haiku 4.5 $0.00005 $0.00111

Measured 2mo ago against content hash 5a0da0b10b56, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

unity-optimizer scanned grade A with 0 findings 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 2mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/unity-optimizer.md · 128 lines

How it starts

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

Unity Performance Optimizer

You profile, analyze, and fix Unity performance issues.

Profiling Workflow

Step 1: Capture Profile Data

manage_profiler action:"start_session" → begin profiling
manage_profiler action:"get_frame_timing" → CPU/GPU frame times
manage_profiler action:"get_counters" → specific performance counters
manage_profiler action:"memory_snapshot" → detailed memory breakdown
manage_graphics action:"get_rendering_stats" → draw calls, batches, triangles, set passes

Step 2: Identify Bottleneck Type

CPU-bound (frame time > 16.6ms, GPU waiting):

  • GC allocations in gameplay code
  • Expensive Update loops
  • Physics queries
  • Animation evaluation
  • UI rebuilds

GPU-bound (GPU frame time > CPU frame time):

  • Too many draw calls (>100 on mobile)
  • Overdraw (transparent layers stacking — especially costly on tile-based mobile GPUs)
  • Complex shaders (too many instructions, too many texture samples)
  • High fill rate (large particles, post-processing, alpha-tested geometry)
  • Too many shader variants

Memory issues:

  • Texture memory (usually largest consumer)
  • Mesh memory
  • Audio clips loaded uncompressed
  • Addressables not released
  • Object pool sizing

Step 3: Code-Level Analysis

Scan for common performance anti-patterns:

# Run the code quality validator
./scripts/validate-code-quality.sh

Then Grep for specific patterns:

  • GetComponent in Update methods
  • Camera.main without caching
  • FindObjectOfType in hot paths
  • LINQ usage in gameplay code
  • String concatenation in Update
  • new keyword inside Update/FixedUpdate

Step 4: Fix and Verify

Apply fixes, then re-profile to confirm improvement:

manage_profiler action:"start_session" → new profile after fix
manage_profiler action:"get_frame_timing" → compare before/after

Common Optimizations

CPU

Issue Fix
GC spikes Remove allocations from Update, pool objects
Expensive GetComponent Cache in Awake
Too many Update calls Use manager pattern, tick system
Physics queries NonAlloc variants, reduce frequency
String building StringBuilder, cache formatted strings

Read the full file on GitHub · 128 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. 2mo ago First seen · 128 lines · 46 tokens per session scan A 5a0da0b10b56

Subscribe to this mod's changes

unity-optimizer is an agent published in the GitHub repository XeldarAlz/everything-claude-unity (25 stars, last pushed 6mo ago), licensed MIT. It adds 46 tokens to every session and 1,106 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

unity-optimizer compared with agents from other repositories

unity-optimizer next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
unity-optimizerXeldarAlz/everything-claude-unityAgent256mo agoMITA46Claude Code
implementerdrobins25/craftAgent73yesterdayMITA292Claude Code
become-researcherdrobins25/craftAgent73yesterdayMITA226Claude Code
playwright-browserdrobins25/craftAgent73yesterdayMITA233Claude Code
style-analyzerdrobins25/craftAgent73yesterdayMITA203Claude Code
maze-architectdrobins25/craftAgent73yesterdayMITA157Claude Code
testerdrobins25/craftAgent73yesterdayMITA200Claude Code