Detailed Method Reference

Namespace: Canley.Utility.CSV.Standard
Class: CSVTable<T>

Definition

public void Load(CanleyCSVManager manager, string overrideName = null)
  • Description: The primary entry point for populating the database, clearing existing records and initiating a two-step discovery process to locate and hydrate data.

  • Workflow:

    1. Hierarchy of Truth: Determines the target filename using an explicit override name, the manager’s target file slot, or defaulting to the C# class name.
    2. Smart-Load Pipeline: Hunts for the file first in the Unity Resources folder (master data), then falls back to Application.persistentDataPath (user saves).
    3. Legacy Header Injection: Automatically checks if the first row matches class fields, injecting a sidecar header file if necessary.
    4. Hydration: Parses the raw string grid and maps rows to strongly-typed records via reflection while populating the shadow dictionary.
  • Parameters:

    • manager: The CanleyCSVManager instance handling underlying file I/O operations.
    • overrideName: An optional explicit filename string to bypass standard naming conventions.
  • Returns: void

  • Example:

public void InitialiseInventory(CSVTable<ItemRecord> inventoryTable, CanleyCSVManager csvManager)
{
    inventoryTable.Load(csvManager);
}

TIP

Use the overrideName parameter when you need to load specific save slots or alternative configurations without changing the manager’s inspector settings.