Computer Language/유니티

다차원 배열

알 수 없는 사용자 2014. 5. 16. 15:37

using UnityEngine;

using System.Collections;


using System;

public class chap10_5 : MonoBehaviour {


// Use this for initialization

void Start () {

int[,,] array = new int [4, 3, 2]{

{{1, 2} , {3, 4} , {5, 6}} ,

{{1, 2} , {3, 4} , {5, 6}} ,

{{1, 2} , {3, 4} , {5, 6}} ,

{{1, 2} , {3, 4} , {5, 6}}

} ;

for(int i = 0; i < array.GetLength(0); i++){

for(int j = 0; j < array.GetLength(1); j++){

// for(int k = 0; k < array.GetLength(2); k++){

// print (string.Format("array[{0},{1},{2}] = {3}", i, j, k, array[i, j, k]));

for(int k = array.GetLowerBound(2); k <= array.GetUpperBound(2); k++){

print (string.Format("array[{0},{1},{2}] = {3}", i, j , k , array[i, j , k]));

}

}

}

}

// Update is called once per frame

void Update () {

}

}