Enum CompressionLevel
Controls the trade-off between output size and processing time for a compression operation. Higher levels produce smaller output but require more CPU time and memory.
Namespace: Scylla.Core.Util.Compression
Assembly: ScyllaCore.dll
Syntax
public enum CompressionLevel
Remarks
This enum maps to the underlying algorithm's native level range. Internally,
MapToSystemCompressionLevel(CompressionLevel) translates these values
to the System.IO.Compression.CompressionLevel equivalents used by GZip and
Deflate streams. Note that the .NET runtime available in Unity only exposes three
compression tiers (NoCompression, Fastest, Optimal); both
Normal and Maximum are mapped to Optimal at
the .NET level, so on GZip and Deflate there is no measurable difference between
them. SharpZipLib-based providers (BZip2, Zip) honour the full integer range and
do differentiate between the two.
The active level is set through Level or via DefaultLevel. The preset Fast uses Fastest and MaxCompression uses Maximum.
Fields
| Name | Description |
|---|---|
| Fastest | Compresses as quickly as possible at the cost of a lower compression ratio. Suitable for real-time scenarios such as network streaming, game save snapshots, or any path where compression latency is more important than output size. |
| Maximum | Produces the smallest possible output at the cost of the highest CPU usage and longest processing time. Suitable for build-time asset packing, archival storage, or any scenario where minimizing output size is the primary concern and processing time is acceptable. |
| None | Data is stored without any compression. Output size equals input size plus format overhead (headers, checksums). Use this when the data is already compressed (e.g., JPEG images, MP3 audio) and further compression would only add CPU cost with no size benefit. |
| Normal | Balances compression ratio against processing speed. This is the default level used by Default and is appropriate for the majority of offline or background compression tasks in a game context. |