Detailed Method Reference

Namespace: Canley.Utility.CSV
Class: CanleyCSVManager

LoadFromResources

public bool LoadFromResources(string fileName)
  • Description: A Unity-specific bridge that loads a CSV file from any Resources folder in your project.

  • Workflow:

    1. State Reset: Clears the existing _reader data to ensure a clean slate.
    2. Path Cleaning: Automatically removes .csv extensions if provided to prevent Unity loading errors.
    3. Asset Loading: Uses Resources.Load<TextAsset> to retrieve the file.
    4. Parsing: If found, it passes the text to ParseRawData() to apply Inspector settings.
  • Parameters:

    • fileName: The name of the file (e.g., “GameData” for “GameData.csv”).
  • Returns: booltrue if the asset was found and successfully parsed.

  • Example:

// Loads 'Assets/Resources/LevelData.csv'
if (csvManager.LoadFromResources("LevelData"))
{
    Debug.Log("Data Loaded!");
}

IMPORTANT

Files must be located within a folder named exactly “Resources” for this method to function.