Resizable Array of Classes?

Hopefully I’m using the right terminology here.

So I’m using JavaScript and I need to create a resizable array that contains a class.

I started with an array that’s visible in the inspector to make sure all my logic was working, and everything works fine. The only downside is that I need to pre-set the number of elements for each array in the inspector in order to avoid “Out Of Range” errors. Considering there’s going to be well over 100 “Missions” each with a range of objectives I really don’t want to enter all this information manually.

So I need the arrays to be resizable and I’m not quite sure how to do that. I’m familiar with regular resizable arrays, just not how to integrate them with a class.

This is the structure using built-in arrays and it works very well:

var missions : Missions[];
class Missions {
	var missionTitle : String;
    var objectives : String[];
    var missionTime : float;
}

So now I need to convert that into a resizable array so that I can easily change the number of missions and the number of objectives. Any suggestions?

Thanks!

Look here for arraylist!

What about using Lists in UnityScript?

import System.Collections.Generic;

var missions : List.<Missions> = List.<Missions>();

class Missions {
    var missionTitle : String;
    var objectives : List.<String> = List.<String>();
    var missionTime : float;
}

And then add or remove objectives and missions

missions.Add(mission);
missions.Remove(mission);
mission.objectives.get(0);