Best way to match up 3 bits of data

Hi Everyone, Sorry about the vague title. I couldn’t think of anything better.

At the moment I’m creating a level selection menu, currently I’m storing the level information in arrays:

var levelsList : String[];
var levelsPictureList : Texture2D[];
var levelsDiscriptionList : String[];

Now the problem with this is we have to manually check that the array indexes match up(so index 0 in each array corresponds to the data for level 1 etc.). I can already tell that this is going to cause issues for us later on.

My question really is; How would I store 3 data types in the same Object, and be able to easily access each bit of data seperately?

I’ve been looking into multidimensional arrays, which is not something I’ve used before. Is this the way forward? If so, any pointers on how to best use a 3d array?

I was also thinking about Serialization. Again, not something I’ve used before, would this be appropriate for what I’m trying to achieve? I’m totally new to serialization, so if this is the best option I might need some guidance :(.

You should make a class:

class LevelData {
	var name : String;
	var picture : Texture2D;
	var description : String;
	
	function LevelData (name : String, picture : Texture2D, description : String) {
		this.name = name;
		this.picture = picture;
		this.description = description;
	}
}

Then:

var levelData = new LevelData[10];
levelData[0] = new LevelData ("Level1", level1pic, "The first level.");

For more information see JScript.NET classes. You can also look up C# classes since it’s mostly the same.

do it like this:

var levels : Object[];

and store the level-Object like this:

levels.push({
    name: 'level1',
    picture: new Texture2D(),
    description: 'the first level'
});

Then you can access the information like this:

levels[0].name
// or
levels[0]['name']

disclaimer: don’t know if that works in unityscript, only know it works in javascript