bool multi-dem array out of range

XCount=4;YCount=4;ZCount=4;

in MultiDem.cs I wrote:

public static bool[,,] BoolArray (int a, int b, int c) {
	return new bool[a,b,c];
}

log: IndexOutOfRangeException: Array index is out of range.
(wrapper managed-to-managed) object:ElementAddr (object,int,int,int)
spawnWalls.Start () (at Assets/Zanzarah_2/Map Generator/spawnWalls.js:16)

var XCount:int ; 				
var YCount:int ; 	
var ZCount:int ;
private var t1:int;					
private var t2:int;
private var t3:int;	
function Start()
{
var CkBk = MultiDim.BoolArray(XCount+2, YCount+2, ZCount+2);	 		//проверка наличия блока	CheckBlock
	for (t1=1;XCount;t1++)
		{
		for (t2=1;YCount;t2++)	     
			{
			for (t3=1;ZCount;t3++)
				{
				CkBk[t1,t2,t3]=false;	
				}
			}
		};
	CkBk[1,1,1]=true;			
Debug.Log("CkBk[1,1,1]= " + CkBk[1,1,1] + "CkBk[1,2,1]= " + CkBk[1,2,1]);                     
}

Your format of your ‘for()’ loop is off. Plus arrays are zero based, so you are not initialize all the elements. Try using these for your ‘for()’ loops.

for (t1=0; t1 < XCount+2; t1++)

and

for (t2=0; t2 < YCount+2; t2++)

and

for (t3=0; t3 < ZCount+2; t3++)