🏗️ Architecture Overview

To use the CSV suite effectively, it is essential to understand the relationship between the Manager, the Reader, and the Grid. This architecture ensures that data remains high-performance and accessible throughout your game’s lifecycle.


1. The Manager (The Interface)

The CanleyCSVManager is a Unity MonoBehaviour designed to live in your Scene. Its primary role is to act as the bridge between your storage (Disk/Resources) and your game logic.

  • Interface: It provides the Unity Inspector fields to assign files and toggle settings.
  • Orchestration: It handles the “loading” process and passes configuration settings—such as whitespace trimming or column padding—down to the underlying engine.

2. The Reader (The Data Holder)

The CanleyCSVReader is a persistent C# class managed by the component. Unlike a simple parser that runs once and disappears, the Reader stays in memory as long as the Manager exists.

  • The Grid: It encapsulates a private _grid (a List<string[]>), which contains your parsed CSV data in a structured, indexable format.
  • The Toolset: It provides the “Lite” toolset—methods like GetCell(), GetRowCount(), and GetHeaderIndex()—allowing you to query data directly from RAM with near-zero latency.

3. The Data Flow

When you initiate a load, the data follows a specific, optimized path:

  1. Source: A file on disk (Application.persistentDataPath) or a TextAsset in a Resources folder.
  2. Transfer: The Manager fetches the raw string and feeds it to the Reader.
  3. Storage: The Reader parses the string into the Grid (RAM).
  4. Access: Your scripts query the Reader to retrieve specific values from the Grid without ever re-accessing the hard drive.

Why this matters for your implementation

For Static Data (eg Items/Rooms)

You only need to load the file once at the start of the game. The Reader holds that table in memory, acting as a high-speed read-only database for the duration of the session. This replaces the need to instantiate hundreds of individual ScriptableObject assets.

For Dynamic Data (eg Saves/Party)

The Manager handles the movement of data back to the disk via the Writer, ensuring your runtime changes—like player stats or inventory updates—are persisted correctly to the local file system.


Summary Table

ObjectTechnical RoleResponsibility
ManagerScene ComponentFile I/O, Path Management, and Initialization.
ReaderData ContainerHolding the Grid and providing search/retrieval methods.
GridMemory BufferThe private List<string[]> where the raw data lives.

Next Steps: Learn how to implement this in your project via the Quick Start Guide.