/performance
Advise on Unity performance red flags. 为 Unity 性能红线提供建议。
$ npx -y skills add Besty0728/Unity-Skills --skill performance --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/performance
Context preview
The summary Claude sees to decide when to auto-load this skill.
Advise on Unity performance red flags. 为 Unity 性能红线提供建议。
SKILL.md
performance.SKILL.mdname: unity-performance
description: Advise on Unity performance red flags. 为 Unity 性能红线提供建议。
Triggers
- Reviewing performance
- Diagnosing frame drops
- Reducing allocations
- Planning pooling/optimization
- 做性能审查、诊断掉帧或卡顿、减少内存分配、规划对象池/优化
Unity Performance Red Flags
Use this skill for a high-signal review of likely Unity performance issues. Focus on red flags, not speculative micro-optimizations.
Check For
- Too many unrelated `Update` / `LateUpdate` / `FixedUpdate` loops
- Repeated `Find`, `GetComponent`, `Camera.main`, or tag lookups in hot paths
- Frequent `Instantiate` / `Destroy` suitable for pooling
- Avoidable per-frame allocations:
- LINQ
- string formatting
- closures
- boxing
- Reflection in runtime hot paths
- Expensive editor-only helpers leaking into runtime code
- Physics, animation, or UI updates happening at the wrong cadence
Hidden Costs: Possibility ≠ Actuality
Three counter-intuitive traps where what seems "free" is actually expensive. Each cost is paid for *possibility* of work, not for work actually performed — which is why profilers rarely catch them directly.
Write permission costs, even without writing
A component whose `Update` *can* mutate `transform.position` pays the cost whether the branch runs or not: dirty-flag and serialization systems treat write permission as a reason to poll every frame. Similarly, a `[SerializeField]` field that is never modified at runtime still sits on the serialization path. The fix is to **remove the permission**, not tighten the branch — split the rarely-needed writer into its own component and `AddComponent` only when needed. *Source: `NetcodeSamples/HelloNetcode/2_Intermediate/07_Optimization/Optimization.md` — "a system with the possibility of writing to a component, regardless of whether it writes to it or not, will always have to be serialized".*
Sequential seeds produce correlated random streams
Seeding N RNG instances with `baseSeed + i` gives N *similar* streams — patrol paths line up, spawn jitter clumps, loot rolls cluster. Hash the index before seeding:
// Wrong — N correlated streams
for (int i = 0; i < N; i++) rngs[i] = new System.Random(baseSeed + i);
// Correct — hash decorrelates adjacent seeds
for (int i = 0; i < N; i++)
rngs[i] = new System.Random((int)((uint)baseSeed * 2654435761u ^ (uint)i));`Unity.Mathematics.Random.CreateFromIndex(i)` applies this internally and is preferred when the math package is available. *Source: `Dots101/Entities101/Assets/HelloCube/3. Prefabs/SpawnSystem.cs:37-39` and its comment.*
Logging fires in release builds by default
`Debug.Log` is **not** stripped in Player builds; only methods marked `[Conditional("UNITY_EDITOR")]` (such as `Debug.DrawLine`) have their arguments elided at the call site. That means a log line with interpolation or helper calls runs every frame in shipped games:
// Wrong — GetPlayerInfo() and string interpolation execute in release
Debug.Log($"Player {GetPlayerInfo()} at {Time.time}");
// Better — guard the whole expression
if (Debug.isDebugBuild) Debug.Log($"Player {GetPlayerInfo()} at {Time.time}");The same principle as the "possibility write" rule above — the runtime pays for the *possibility* of work, not only for the work.
Output Format
- Confirmed red flags
- Likely red flags
- Changes worth doing now
- Changes not worth doing now
- Expected gain category: clarity / frame time / GC / scalability
Guardrails
> **Mode**: Documentation only — no REST skills to gate; load freely under any operating mode (Approval / Auto / Bypass).
- Do not recommend large refactors without a meaningful hotspot.
- Do not replace simple code with unreadable “optimized” code unless the hot path is real.
Read more
name: unity-performance description: Advise on Unity performance red flags. 为 Unity 性能红线提供建议。
Triggers
- Reviewing performance
- Diagnosing frame drops
- Reducing allocations
- Planning pooling/optimization
- 做性能审查、诊断掉帧或卡顿、减少内存分配、规划对象池/优化
Unity Performance Red Flags
Use this skill for a high-signal review of likely Unity performance issues. Focus on red flags, not speculative micro-optimizations.
Check For
- Too many unrelated `Update` / `LateUpdate` / `FixedUpdate` loops
- Repeated `Find`, `GetComponent`, `Camera.main`, or tag lookups in hot paths
- Frequent `Instantiate` / `Destroy` suitable for pooling
- Avoidable per-frame allocations:
- LINQ
- string formatting
- closures
- boxing
- Reflection in runtime hot paths
- Expensive editor-only helpers leaking into runtime code
- Physics, animation, or UI updates happening at the wrong cadence
Hidden Costs: Possibility ≠ Actuality
Three counter-intuitive traps where what seems "free" is actually expensive. Each cost is paid for *possibility* of work, not for work actually performed — which is why profilers rarely catch them directly.
Write permission costs, even without writing
A component whose `Update` *can* mutate `transform.position` pays the cost whether the branch runs or not: dirty-flag and serialization systems treat write permission as a reason to poll every frame. Similarly, a `[SerializeField]` field that is never modified at runtime still sits on the serialization path. The fix is to **remove the permission**, not tighten the branch — split the rarely-needed writer into its own component and `AddComponent` only when needed. *Source: `NetcodeSamples/HelloNetcode/2_Intermediate/07_Optimization/Optimization.md` — "a system with the possibility of writing to a component, regardless of whether it writes to it or not, will always have to be serialized".*
Sequential seeds produce correlated random streams
Seeding N RNG instances with `baseSeed + i` gives N *similar* streams — patrol paths line up, spawn jitter clumps, loot rolls cluster. Hash the index before seeding:
// Wrong — N correlated streams
for (int i = 0; i < N; i++) rngs[i] = new System.Random(baseSeed + i);
// Correct — hash decorrelates adjacent seeds
for (int i = 0; i < N; i++)
rngs[i] = new System.Random((int)((uint)baseSeed * 2654435761u ^ (uint)i));`Unity.Mathematics.Random.CreateFromIndex(i)` applies this internally and is preferred when the math package is available. *Source: `Dots101/Entities101/Assets/HelloCube/3. Prefabs/SpawnSystem.cs:37-39` and its comment.*
Logging fires in release builds by default
`Debug.Log` is **not** stripped in Player builds; only methods marked `[Conditional("UNITY_EDITOR")]` (such as `Debug.DrawLine`) have their arguments elided at the call site. That means a log line with interpolation or helper calls runs every frame in shipped games:
// Wrong — GetPlayerInfo() and string interpolation execute in release
Debug.Log($"Player {GetPlayerInfo()} at {Time.time}");
// Better — guard the whole expression
if (Debug.isDebugBuild) Debug.Log($"Player {GetPlayerInfo()} at {Time.time}");The same principle as the "possibility write" rule above — the runtime pays for the *possibility* of work, not only for the work.
Output Format
- Confirmed red flags
- Likely red flags
- Changes worth doing now
- Changes not worth doing now
- Expected gain category: clarity / frame time / GC / scalability
Guardrails
> **Mode**: Documentation only — no REST skills to gate; load freely under any operating mode (Approval / Auto / Bypass).
- Do not recommend large refactors without a meaningful hotspot.
- Do not replace simple code with unreadable “optimized” code unless the hot path is real.
REST API-based AI-driven Unity Editor Automation Engine Let AI control Unity scenes directly through Skills 🎉 We are now indexed by DeepWiki! Got questions? Check out the AI-generated docs → The current official maintenance baseline is Unity 2022.3+.
Other skills on unity-skills.
- /addressables-design
Source-anchored design rules for Unity Addressables 1.22.3/2.9.1. 为 Unity Addressables 1.22.3/2.9.1 提供源码锚定的设计规则。
Open skill - /adr
Record Unity architecture decisions (ADR) with rationale. 记录 Unity 架构决策(ADR)与理由。
Open skill - /animator
Edit Unity Animator Controllers and drive runtime parameters. 编辑 Unity Animator Controller 并驱动运行时参数。
Open skill - /architecture
Advise on Unity gameplay and system architecture. 为 Unity 游戏与系统架构提供建议。
Open skill - /asmdef
Advise on Unity assembly definitions (asmdef). 为 Unity 程序集定义(asmdef)提供建议。
Open skill - /asset
Manage Unity AssetDatabase operations. 管理 Unity AssetDatabase 操作。
Open skill

