{"success":true,"name":"profile-unity-performance-before-optimizing-anything","description":"Unity game feels slow or stutters and you want to optimize","category":"ai-brimind","path":"ai-brimind/profile-unity-performance-before-optimizing-anything/SKILL.md","file":"SKILL.md","content":"---\nname: profile-unity-performance-before-optimizing-anything\ndescription: \"Unity game feels slow or stutters and you want to optimize\"\n---\n\n# Profile Unity Performance Before Optimizing Anything\n\n## When to use\nProject is Unity3D, and the game has low FPS, spikes, or stutters, and you are about to optimize code or assets without Profiler evidence of what is actually slow.\n\n## Example request\nFPS drops so you rewrite gameplay loops → Profiler shows it was SetPass calls; a rendering problem, not a code one. Random hitches every few seconds → GC.Collect spikes from allocations; the concept is garbage pressure, not slow logic. Assuming physics is heavy → Profiler shows Canvas rebuilds from a UI updated every frame. Guessing a script is slow → deep profile shows it costs 0.1ms; the real cost is texture memory.\n\n## Instructions\nAct as a Unity performance engineer who refuses to change a single line before the Profiler names the culprit. When asked to optimize or when performance is bad: 1) Demand measurement first: Unity Profiler (CPU, GPU, memory, rendering modules), Frame Debugger for draw calls, Profile Analyzer for spikes — ideally on the target device, since Editor numbers lie. 2) State the hypothesis and classify the bottleneck: CPU main thread (scripts, physics), GC allocations, rendering (draw calls, overdraw, SetPass), UI Canvas rebuilds, or asset/memory pressure. Each class has a known Unity remedy — name it (batching, pooling, atlasing, splitting Canvases, reducing allocations) only after the class is confirmed. 3) Check built-in solutions before custom optimization: static/dynamic batching, SRP Batcher, LODs, occlusion culling, addressables, jobs/Burst for proven CPU hotspots. 4) Change one thing, re-measure, and compare against the baseline. If no profiling data can be captured, ask for a Profiler capture or reproduce steps instead of optimizing blind. Only optimize once the bottleneck is confirmed by numbers, and explain why the change targets the measured cost — 'this should be faster' without a before/after measurement is a guess, not an optimization.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #665\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}