CanleyCSVManager
Namespace: Canley.Utility.CSV
Base Class: MonoBehaviour
Overview
The CanleyCSVManager is the central hub for all CSV operations within the suite. It acts as the bridge between raw data (files or strings) and your game logic, managing the lifecycle of the CanleyCSVReader and CanleyCSVWriter instances.
It is designed to be “Drop-in Ready,” allowing you to point to a file path in the Inspector and have parsed data available immediately via the OnDataLoaded event.
Method Reference
Detailed documentation for each method can be found in the CanleyCSVManager subfolder.
| Class | Method (Syntax) | Description |
|---|---|---|
| CanleyCSVManager | LoadFromResources() | Clears internal memory and loads a CSV from a Unity Resources folder. Returns false if not found. |
| CanleyCSVManager | LoadFromFilePath() | Clears internal memory and loads a CSV from a local disk path. Returns false if the file is missing. |
| CanleyCSVManager | ParseRawData() | Injects a raw string into the Manager. Note: Passing "" will manually clear the Reader. |
| CanleyCSVManager | SaveToFile() | Saves a string to disk. Defaults to persistentDataPath unless a full path is provided. Returns false on I/O errors. |
Key Features
- Multi-Platform I/O: Handles the nuances of file paths across Windows, Mac, Android, and iOS automatically.
- UTF-8 Support: Built-in logic to detect and strip Byte Order Marks (BOM) to prevent parsing errors in header strings.
- Inspector Integration: Configure parsing rules (like Auto-Padding or Trim Whitespace) directly in the Unity Editor without writing code.
NOTE
For global projects, ensure
CanleyCSVManager.UseInvariantCultureis set totruebefore calling load methods to maintain numeric consistency across different regional settings.