unity-performance

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

2|Updated May 18, 2026
One-click install
npx skills add https://github.com/pcone-mm/NewFPG --skill unity-performance-pcone-mm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-performance
Source: https://github.com/pcone-mm/NewFPG/tree/main/.agents/skills/unity-skills/skills/performance
Command: npx skills add https://github.com/pcone-mm/NewFPG --skill unity-performance-pcone-mm

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 Unity code without speculative micro-optimizations. ## Core Features & Use Cases - Hot Path Review: Detects excessive Update/LateUpdate/FixedUpdate loops, repeated Find/GetComponent/Camera.main lookups, and Instantiate/Destroy patterns suitable for pooling. - Allocation Analysis: Flags per-frame allocations from LINQ, string formatting, closures, boxing, and reflection in runtime code. - Hidden Cost Detection: Reveals 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 "怎么优化", use this Skill to audit their MonoBehaviour scripts and produce a prioritized list of confirmed red flags, likely issues, and changes worth doing now versus later. ## Quick Start Review my Unity player controller and enemy spawner scripts for performance red flags and tell me which changes are worth making now.

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 provides a structured checklist separating confirmed red flags from speculative issues.

How to reduce GC allocations in Unity Update methods?

Avoid LINQ queries, string interpolation, closures, and boxing inside Update loops since each creates garbage every frame. Cache component references and use object pooling instead of repeated Instantiate and Destroy calls.

Does Debug.Log affect performance in Unity release builds?

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

Why does my Unity game stutter even with few objects?

Hidden costs like write-permission serialization can poll components every frame regardless of whether writes occur. Components that can mutate transform.position pay dirty-flag costs even when the write branch never runs.

When should I use object pooling in Unity?

Use pooling when you frequently Instantiate and Destroy similar objects like bullets, enemies, or particles during gameplay. The Skill flags frequent instantiation patterns as red flags but warns against refactoring without a confirmed hotspot.

What are the limitations of profiler-based Unity optimization?

Profilers rarely catch possibility-based costs like serialization of writable components or correlated RNG streams from sequential seeds. These require code review against known anti-patterns rather than runtime measurement alone.