Skip to content

t1k:unity:editor:profiling

FieldValue
Moduleeditor
Version3.50.7
Effortmedium
Tools—

Keywords: optimization, performance, profiling, unity profiler

/t1k:unity:editor:profiling

Unity 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.

Window → Analysis → Profiler (Ctrl+7)

ModuleKey Metrics
CPU UsageMain Thread ms, GC Alloc
GPU UsageDraw calls, GPU ms
RenderingSetPass calls, batches
MemoryTotal allocated, GC
PhysicsActive bodies, contacts
AudioPlaying 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.

  • 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.

SymptomLikely CauseFix
CPU spike every few framesGC collectionPool objects, use structs
High “Scripts” timeExpensive Update()Cache components
High “Rendering” timeToo many draw callsBatch, atlas textures
GPU bound (CPU idle)Complex shadersSimplify, reduce transparency
Memory grows over timeLeakMemory 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.Split per table read (Ints("field"), Floats(...)) inside a per-entity or per-tick loop;
  • GetComponentObject / GetNode / GetComponent per frame instead of cached;
  • ToEntityArray / ToComponentDataArray per frame purely to read a position;
  • unconditional RectTransform/text/fillAmount/color writes with no unchanged-value guard;
  • raycastTarget: true on non-interactive Images (count it, then mark the cost SUSPECTED);
  • Debug.Log in a hot loop — a release logger filter drops the message but still evaluates the arguments, so the allocation happens.
  1. Editor vs Build: Editor is 2–10x slower — always profile builds
  2. GC.Alloc column: Any allocation in Update/FixedUpdate is a red flag
  3. Burst code: Shows as single block — use ProfilerMarker inside Burst jobs
  4. 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.

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.

  • t1k-unity-dots-core-performance — DOTS profiling (use t1k-unity-dots-core-optimizer agent)
  • t1k-unity-mobile-core — Device profiling patterns
  • t1k-unity-rendering-urp — SRP Batch Debugger
  • t1k-unity-dots-core-debugger agent — ECS runtime debug
FileContents
references/profiling-api.mdFull API, all tools, bottleneck table, gotchas
references/optimization-targets.mdMobile/desktop rendering thresholds (draw calls, tris, memory) cited by t1k-unity-optimize-assets budgets