Skip to content

UNI020: String concatenation in hot path

What and why

String concatenation, interpolation, or string.Format/Join inside MonoBehaviour per-frame methods (Update, FixedUpdate, LateUpdate, OnGUI, coroutines). Prefer StringBuilder or cached strings.

String building in hot paths allocates temporary strings.

How to fix: use StringBuilder, cached strings, or numeric formatting buffers.

Fix guidance

Use StringBuilder or cached strings instead of concatenation in hot paths.

Tags

performance, unity

Suppression

Use // unilyze-disable-next-line UNI020 -- reason immediately before the reported line. These detector findings are line-based, so separate overload occurrences can be suppressed independently. For project-wide suppression, use "rules": { "UNI020": "off" }; use a baseline to freeze existing findings while reporting new ones.