CsvUtility
CsvUtility is a lightweight Csv serializer and deserializer that mimics Unity's native JsonUtility syntax. It supports of primitives, enums, collections, and custom type extensions
by PenguinGod
Price History +
CsvUtility is designed to solve the cumbersome and repetitive workflow of handling CSV tables in Unity. With a clean 1-line API syntax mimicking JsonUtility, you can load and save data tables out-of-the-box.
Key Architecture & Advantages:
1. Complete Primitive & Enum Support:
Natively parses all primitive types (byte, int, float, bool, string, etc.) and custom Enums. It features smart formatting such as automatic string trimming and case-insensitive enum parsing to guarantee crash-free runtimes.
2. Dynamic 1-Element-1-Cell Collection Parsing:
Arrays, Lists, and Dictionaries are completely supported. CsvUtility automatically calculates the maximum length of your collections and expands CSV columns dynamically (1 Element = 1 Column mapping). It safely handles missing data with padding commas (,,) to prevent table-shifting bugs.
3. Deep Nested Classes & Structs:
Supports deep nesting of serializable custom classes and structs. Field scopes are safely preserved with structured header mapping.
[How to Use - Quick Sample]
// Load Data
MyData[] loadDatas = CsvUtility.CsvToArray<MyData>(csvTextAsset.text);
// Save Data
string csvResult = CsvUtility.ArrayToCsv(loadDatas);