Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Creating a dynamic jagged array

Discussion in 'Scripting' started by Kinkku2, May 7, 2015.

  1. Kinkku2

    Kinkku2

    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:
    385
    either use a dictionary or a list of lists
    Code (csharp):
    1. Dictionary<int, List<Vector3>> .... ;
    2. List<List<Vector3>> ....;
     
  3. Kinkku2

    Kinkku2

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