Skip to content

ZString Integration

Requirements: ZString package (com.cysharp.zstring)

Enables zero-allocation string formatting for performance-critical code.

Usage:

csharp
// Zero-allocation formatting
Span<char> buffer = stackalloc char[256];
if (Localization.TryFormat(buffer, out int written, "ui.score", score))
{
    ReadOnlySpan<char> result = buffer.Slice(0, written);
    // Use result without heap allocation
}

Note

Without ZString, TryFormat still works but may allocate during complex formatting.


Professional Unity Development Tools