CSVTable

Namespace: Canley.Utility.CSV.Standard
Base Class: ScriptableObject

Overview

The CSVTable<T> class is a generic ScriptableObject container that manages collections of CSVRecord items within Unity. It acts as the central orchestration layer for loading, parsing, querying, and serialising CSV datasets, bridging spreadsheet files directly into strongly-typed game data.

By managing both asset lists and internal indexing structures, it provides rapid lookups by ID or record label while handling runtime modifications and round-trip file generation safely.


Supported Types

CSV Standard includes a built-in “Translator” for common Unity math and visual types: SupportedTypes


Property Reference

ClassMember (Syntax)Description
CSVTable<T>RecordsGets the live list of ScriptableObject data currently held in memory.
CSVTable<T>validationModeControls how mapping errors are handled during the hydration process.
CSVTable<T>idTypeDetermines whether new IDs are generated as integers or UUIDs.
CSVTable<T>rotationModeControls how Quaternion data is handled during import and export.

Method Reference

ClassMember (Syntax)Description
CSVTable<T>CreateRecord(string label)Instantiates a new record at runtime with a unique ID.
CSVTable<T>Load(CanleyCSVManager manager, string overrideName)Fetches the parsed grid from the Lite Core and maps it via reflection.
CSVTable<T>LoadPolymorphic(CanleyCSVManager manager, string typeColumn)Supports heterogeneous data by instantiating subclasses based on a type column.
CSVTable<T>GetRecord(int id)Finds a specific record by its unique integer ID.
CSVTable<T>GetRecord(string label)Finds a record by its record label in a case-insensitive manner.
CSVTable<T>GetRecords(Func<T, bool> pred)Filters the database using a predicate query engine.
CSVTable<T>RemoveRecord(T record)Removes a specific record from the local records list.
CSVTable<T>RemoveRecordById(int id)Locates and deletes a record from memory using its unique ID.
CSVTable<T>GetRawGrid()Merges live C# data with the shadow dictionary to preserve unmapped columns.
CSVTable<T>SaveTable(CanleyCSVManager manager)Smart saves back to the filename established during the load process.
CSVTable<T>SaveTable(CanleyCSVManager manager, string path)Manually saves the table state to a specific custom file path.
CSVTable<T>SortByField(string name, bool asc)Reorders the records list using reflection based on any column header.
CSVTable<T>SpawnUI(List<T> data, GameObject prefab, Transform parent)Instantiates and populates prefabs for every record implementing the display contract.

Key Features

  • Generic Type Safety: Enforces strict typing against any class extending CSVRecord, ensuring compile-time safety for your domain models.
  • Dual Indexing: Automatically builds internal lookup structures for both integer IDs and string slugs to maintain high performance during runtime queries.
  • UI Orchestration: Streamlines list-based interface generation through built-in instantiation methods that couple seamlessly with display interfaces.

NOTE

Ensure that your implementation assets are properly configured within your project hierarchy so the generic table can reference and hydrate your custom record types correctly.

17 items under this folder.