Creating a dynamic array of objects of custom class

I’ve created a custom class and I’m trying to store in an array some objects of this class. I need the array to be dynamic.

I cannot use ‘push’ in unityscript as in arrays in javascript because the compiler complains that:

'push' is not a member of 'InvItem[]'

That’s my code:

var itemCount : int = 3;
var items : InvItem[] = new InvItem[itemCount];

but I cannot insert/delete items in that array.

How is that possible? Can I use something similar to malloc and free combination, as in C?

What I am trying to do is to have a place so as to store all my inventory items so as to know how to effectively draw a GUI ScrollView (how many items there are, what are the names of each one, how many times each one appears etc).

I believe this is what you’re looking for. Unity’s “javascript” implementation is (IMO) garbage. If you’re going to stick with Unity you’d be better off switching to C# sooner than later.