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
Resourcesfolder in your project. -
Workflow:
- State Reset: Clears the existing
_readerdata to ensure a clean slate. - Path Cleaning: Automatically removes
.csvextensions if provided to prevent Unity loading errors. - Asset Loading: Uses
Resources.Load<TextAsset>to retrieve the file. - Parsing: If found, it passes the text to
ParseRawData()to apply Inspector settings.
- State Reset: Clears the existing
-
Parameters:
fileName: The name of the file (e.g., “GameData” for “GameData.csv”).
-
Returns:
bool—trueif 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.