Search Unity

Creating a dynamic jagged array

Discussion in 'Scripting' started by matias-e, May 7, 2015.

  1. matias-e

    matias-e

    Joined:
    Sep 29, 2014
    Posts:
    106
    Hey, so I ran into a bit of a problem. I have a 'List<Vector3>' that is saved into the first slot of a jagged array. Each list of Vector3's in scene one would be saved in column 0, say 6 lists of Vector3's saved. Then when I move onto scene two, the jagged array would move to column 1 and be able to save all the lists within the scene here.

    How would I go about doing this with C#?
     
  2. dterbeest

    dterbeest

    Joined:
    Mar 23, 2012
    Posts:
    389
    either use a dictionary or a list of lists
    Code (csharp):
    1. Dictionary<int, List<Vector3>> .... ;
    2. List<List<Vector3>> ....;
     
  3. matias-e

    matias-e

    Joined:
    Sep 29, 2014
    Posts:
    106
    Thanks, I'll try that out!