unity-performance

Reviews Unity code for performance red flags in Update loops, allocations, pooling, and physics hot paths.

Updated Jun 21, 2026
One-click install
npx skills add https://github.com/du-qwq/Shader-Writing-Architecture-and-Specifications --skill unity-performance-du-qwq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-performance
Source: https://github.com/du-qwq/Shader-Writing-Architecture-and-Specifications/tree/main/.agents/skills/unity-skills/skills/performance
Command: npx skills add https://github.com/du-qwq/Shader-Writing-Architecture-and-Specifications --skill unity-performance-du-qwq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity projects often suffer from frame drops, stutter, and GC pressure caused by hidden performance anti-patterns that profilers miss. This Skill provides a high-signal review checklist that identifies confirmed and likely red flags in your code without speculative micro-optimizations. ## Core Features & Use Cases - Hot Path Detection: Flags excessive Update/LateUpdate/FixedUpdate loops, repeated Find/GetComponent/Camera.main lookups, and Instantiate/Destroy patterns suitable for pooling. - Allocation Analysis: Identifies per-frame allocations from LINQ, string formatting, closures, boxing, and reflection in runtime code. - Hidden Cost Awareness: Explains counter-intuitive traps like write-permission serialization costs, correlated RNG seeds, and Debug.Log executing in release builds. - Use Case: When a user says "太卡了" or "怎么优化", the Skill reviews their Unity scripts and outputs confirmed red flags, prioritized changes, and expected gain categories (frame time, GC, scalability). ## Quick Start Ask the AI to review my Unity scripts for performance red flags and frame drop causes.

Frequently Asked Questions about unity-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find performance problems in Unity code?

Review hot paths for repeated Find, GetComponent, and Camera.main calls, excessive Update loops, and per-frame allocations from LINQ or string formatting. This Skill flags confirmed and likely red flags with prioritized fixes.

How to reduce GC allocations in Unity per frame?

Avoid LINQ, string interpolation, closures, and boxing in Update loops. Replace frequent Instantiate/Destroy with object pooling, and move reflection out of runtime hot paths.

Does Debug.Log run in Unity release builds?

Yes, Debug.Log is not stripped in Player builds, so string interpolation and helper calls execute every frame in shipped games. Guard log statements with Debug.isDebugBuild or use Conditional attributes.

Why does my Unity game stutter even with few objects?

Hidden costs include serialization polling for components with write permission, even when no write occurs. Split rarely-mutating logic into separate components added only when needed.

When should I not optimize Unity code?

Avoid large refactors without a meaningful hotspot, and do not replace readable code with obscure optimized versions unless the hot path is real. Focus on confirmed red flags first.