title: Adding values from text file to 2D Array c#
body: <p>EDITED---
  I was having trouble adding values to a 2D Array in my foreach loop. Hari pointed out that I needed to declare i = 0 and my array before the loop and that I had the assignments of the value backwards. (Thank you).
  However, I have tried to add a final intensity array and Debug.Log the values for i and the console reads "System.Single[]" instead of the value of the single. Any idea why this is?
   Thank you!!</p>
  
  <p>Here is my code:</p>
  
  <pre><code>using UnityEngine;
  using System;
  using System.Collections;
  using System.Collections.Generic;
  
  //[Serializable]
  public class MultiArrayList2 : MonoBehaviour {
  
  public TextAsset datafile;
  private int i;
  private float[,] coordinates;
  private float[] intensity;
  
  // Use this for initialization
  void Start() {
  
      string[] dataLines = datafile.text.Split ('\n');
      string[] lineValues;
      //print (dataLines.Length);
      i=0;
  
      float[,] coordinates = new float[6853, 3];  
      float[] intensity = new float[6853];
      foreach (string line in dataLines) {
  
          lineValues = line.Split (' ');
          float coordinateX = float.Parse (lineValues [0]);
          float coordinateY = float.Parse (lineValues [1]);
          float coordinateZ = float.Parse (lineValues [2]);
          float intens = float.Parse (lineValues [3]);
  
          coordinates [i, 0] = coordinateX;
          coordinates [i, 1] = coordinateY;
          coordinates [i, 2] = coordinateZ;
  
          intensity [i] = intens;
  
          Debug.Log (intensity);
  
          i++;        
  
      }
  
  }
  </code></pre>
  
  <p>}</p>