title: Serializing list of 2 dimensional arrays in Unity
body: <p>I'm hoping someone can help to serialize this 2d array configuration... essentially it serializies everything but doesn't serialize the 2d arrays called wallConfig0...3. Right now I have 4 of them, but I'd like to have a list of wallConfig 2d arrays that I can serialize to JSON. Please give me some guidance on how to serialize this data structure. Thanks.</p>
  
  <p>-Rik</p>
  
  <p>I have a list of rooms:</p>
  
  <pre><code>    [Serializable]
  public class RoomDataList
  {
      public List&lt;RoomData&gt; roomDataList = new List&lt;RoomData&gt;();
  }
  </code></pre>
  
  <p>Each room has this data:</p>
  
  <pre><code>[Serializable]
      public class RoomData {
          public int[,] wallConfig0;//TODO: change to list of 2d arrays
          public int[,] wallConfig1;
          public int[,] wallConfig2;
          public int[,] wallConfig3;
  
      public float[] wallLoc0;//TODO: change to list of vector3
      public float[] wallLoc1;
      public float[] wallLoc2;
      public float[] wallLoc3;
  
      public float wallRot0;
      public float wallRot1;
      public float wallRot2;
      public float wallRot3;
  
      public int[,] floorConfig;
      public int parentRoomIndex;
      public int parentDoorIndex;
      public float parentDoorWallSize;
      public int roomIndex;
      public Vector3 location;
      public Quaternion rotation;
      public string filePath;
      public string[] folderContents0;
      public string[] folderContents1;
  }
  </code></pre>
  
  <p>Here are my load/save to JSON functions:</p>
  
  <pre><code>private static RoomDataList LoadRoomData(string path) {
      string json = File.ReadAllText(path);
      return JsonUtility.FromJson&lt;RoomDataList&gt;(json);
  
  }
  private static void SaveRoomData(string path, RoomDataList roomDataList) {
      string json = JsonUtility.ToJson(roomDataList);
  
      StreamWriter sw = File.CreateText(path);
      sw.Close();
      File.WriteAllText(path, json);
  }
  </code></pre>