// Use this for initialization void Start() { // Set pointlist to results of function Reader with argument inputfile pointList = CSVReader.Read(inputfile); //Log to console Debug.Log(pointList); // Declare list of strings, fill with keys (column names) List <string> columnList = new List <string>(pointList[1].Keys); // Print number of keys (using .count) Debug.Log("There are " + columnList.Count + " columns in the CSV"); foreach (string key in columnList) { Debug.Log("Column name is " + key); } // Assign column name from columnList to Name variables xName = columnList[columnX]; yName = columnList[columnY]; zName = columnList[columnZ]; // Get maxes of each axis float xMax = FindMaxValue(xName); float yMax = FindMaxValue(yName); float zMax = FindMaxValue(zName); // Get minimums of each axis float xMin = FindMinValue(xName); float yMin = FindMinValue(yName); float zMin = FindMinValue(zName); //Loop through Pointlist for (var i = 0; i < pointList.Count; i++) { // Get value in poinList at ith "row", in "column" Name, normalize float x = (System.Convert.ToSingle(pointList[i][xName]) - xMin) / (xMax - xMin); float y = (System.Convert.ToSingle(pointList[i][yName]) - yMin) / (yMax - yMin); float z = (System.Convert.ToSingle(pointList[i][zName]) - zMin) / (zMax - zMin); // Instantiate as gameobject variable so that it can be manipulated within loop GameObject dataPoint = Instantiate( PointPrefab, new Vector3(x, y, z) * plotScale, Quaternion.identity); // Make child of PointHolder object, to keep points within container in hiearchy dataPoint.transform.parent = PointHolder.transform; // Assigns original values to dataPointName string dataPointName = pointList[i][xName] + " " + pointList[i][yName] + " " + pointList[i][zName]; // Assigns name to the prefab dataPoint.transform.name = dataPointName; // Gets material color and sets it to a new RGB color we define dataPoint.GetComponent <Renderer>().material.color = new Color(x, y, z, 1.0f); } }