using System; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; using UnityEngine; public class CSVLoader { //Reference file; private TextAsset csvFile; private char lineSeperator = '\n'; private char surrond = '"'; private string[] fieldSeperator = { "\", \"" }; public void LoadCSV() { csvFile = Resources.Load("localisation"); } public Dictionary GetDictionaryValues(string attributeID) { Dictionary dictionary = new Dictionary(); string[] lines = csvFile.text.Split(lineSeperator); int attributeIndex = -1; string[] headers = lines[0].Split(fieldSeperator, StringSplitOptions.None); for(int i=0; i attributeIndex) { var key = fields[0]; if (dictionary.ContainsKey(key)) { continue; } var value = fields[attributeIndex]; dictionary.Add(key, value); } } return dictionary; } }