Iterate All Variables in Serializable

Hi… I have a serializable (Unity - Scripting API: Serializable) of arrays of Textures, and cannot figure out how to iterate through all of it…

class Themes extends System.Object {
    var Theme1 : Texture2D[];
    var Theme2 : Texture2D[];
    var Theme3 : Texture2D[];
var defaultThemes = Themes ();

That is the coding I have, but I can’t get it to go from Theme1, to Theme2, then Theme3, etc. I’m new to this kind of complex arrays, sorry if this is really easy…


You would have to write a special function to do it since your 3 arrays are separate variables. So the function would basically iterate through one array, then move onto the next, then the next:

void IterateThroughArrays(){
    foreach(Texture2D myTexture1 in Theme1){
      //iterate the first array

    foreach(Texture2D myTexture2 in Theme2){
      //iterate the second array

    foreach(Texture2D myTexture3 in Theme3){
      //iterate the third array