array question

I am working with a script that will contain patterns with numbers, and for each level you gain, it jumps to the next part of the array. What I want to do is use Multidimensional Arrays to do this, but apparently they dont work in Unity.

So is it possible to make an array work like this:

var multAry=new Array();
multAry[0]=(1,2,3,4);
multAry[1]=(5,6,7,8);

The thing is, I have a variable that takes what level you are on. WIth that number, it will call the array string. For example, if the var is 0, then it will call multAry[0], and if its 1, it will call multAry[1]. Any ideas?

They work fine; that’s incorrect syntax. You’d want to use this:

var multAry=new Array();
multAry[0]=new Array(1,2,3,4);
multAry[1]=new Array(5,6,7,8);

Better yet, use multi-dimensional built-in arrays, which are much faster than Array. (Use this for Javascript.)

–Eric

Thx for the help. It rly helps out :smile: