t1k:unity:editor:profiling
| Field | Value |
|---|---|
| Module | editor |
| Version | 3.50.7 |
| Effort | medium |
| Tools | — |
Keywords: optimization, performance, profiling, unity profiler
How to invoke
Section titled “How to invoke”/t1k:unity:editor:profilingUnity Profiling — Performance Analysis Tools
Section titled “Unity Profiling — Performance Analysis Tools”Profiling reference for Unity 6. For DOTS-specific profiling, see t1k-unity-dots-core-performance.
Profiler Window
Section titled “Profiler Window”Window → Analysis → Profiler (Ctrl+7)
| Module | Key Metrics |
|---|---|
| CPU Usage | Main Thread ms, GC Alloc |
| GPU Usage | Draw calls, GPU ms |
| Rendering | SetPass calls, batches |
| Memory | Total allocated, GC |
| Physics | Active bodies, contacts |
| Audio | Playing sources, CPU % |
Custom Markers (ProfilerMarker) — Quick Reference
Section titled “Custom Markers (ProfilerMarker) — Quick Reference”using Unity.Profiling;
static readonly ProfilerMarker s_UpdateMarker = new("GameSystem.Update");
void Update() { using (s_UpdateMarker.Auto()) { DoGameLogic(); } // Auto-dispose scope}→ See references/profiling-api.md for full ProfilerMarker, ProfilerRecorder, custom counters.
Key Tools
Section titled “Key Tools”- Memory Profiler: Install
com.unity.memoryprofiler→ compare snapshots to find leaks - Frame Debugger: Window → Analysis → Frame Debugger → inspect every draw call
- Device Profiling: Build with Development Build + Autoconnect Profiler; connect USB or WiFi
→ See references/profiling-api.md for device setup, automated logging, and deep profiling details.
Common Bottlenecks
Section titled “Common Bottlenecks”| Symptom | Likely Cause | Fix |
|---|---|---|
| CPU spike every few frames | GC collection | Pool objects, use structs |
| High “Scripts” time | Expensive Update() | Cache components |
| High “Rendering” time | Too many draw calls | Batch, atlas textures |
| GPU bound (CPU idle) | Complex shaders | Simplify, reduce transparency |
| Memory grows over time | Leak | Memory Profiler snapshots |
→ Full bottleneck table and gotchas in references/profiling-api.md.
Static audit before a profiler run (when the profiler is not available)
Section titled “Static audit before a profiler run (when the profiler is not available)”A read-only grep/read pass over the hot paths produces the candidate list and the cost shape,
never the seconds. Do this first when no device run is possible, label every figure static, and
convert it to a measurement before it drives a change. Finding classes worth sweeping for
(full table in t1k-unity-mobile-build-size/references/startup-and-runtime.md):
- per-tick
new Dictionary<,>/new List<>()built only to pass to a helper; string.Splitper table read (Ints("field"),Floats(...)) inside a per-entity or per-tick loop;GetComponentObject/GetNode/GetComponentper frame instead of cached;ToEntityArray/ToComponentDataArrayper frame purely to read a position;- unconditional
RectTransform/text/fillAmount/colorwrites with no unchanged-value guard; raycastTarget: trueon non-interactiveImages (count it, then mark the costSUSPECTED);Debug.Login a hot loop — a release logger filter drops the message but still evaluates the arguments, so the allocation happens.
Hard rules
Section titled “Hard rules”- Editor vs Build: Editor is 2–10x slower — always profile builds
- GC.Alloc column: Any allocation in Update/FixedUpdate is a red flag
- Burst code: Shows as single block — use
ProfilerMarkerinside Burst jobs - A static audit is not a measurement: a grep-derived hot path can be real and still not the
frame’s cost. Label it
static, and say what the profiler would have to show to confirm it.
CLI status
Section titled “CLI status”No profiler commands exist in t1k unity yet. Use the Profiler window by hand, or in Play mode t1k unity dots performance_snapshot for DOTS system timings and t1k unity dots get_render_stats for rendering counts. Never wait on a profiler capture from a script.
Related Skills & Agents
Section titled “Related Skills & Agents”t1k-unity-dots-core-performance— DOTS profiling (uset1k-unity-dots-core-optimizeragent)t1k-unity-mobile-core— Device profiling patternst1k-unity-rendering-urp— SRP Batch Debuggert1k-unity-dots-core-debuggeragent — ECS runtime debug
Reference Files
Section titled “Reference Files”| File | Contents |
|---|---|
references/profiling-api.md | Full API, all tools, bottleneck table, gotchas |
references/optimization-targets.md | Mobile/desktop rendering thresholds (draw calls, tris, memory) cited by t1k-unity-optimize-assets budgets |