
Sample.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 2次元配列
// * Table/表
public class Sample : MonoBehaviour
{
// 宣言方法
// 1次元配列
int[] arrayInt = new int[3];
// 2次元配列
int[,] tabelInt = new int[3, 2];
void Start()
{
// 代入方法
tabelInt[0, 0] = 1;
tabelInt[2,1] = 10;
// 取得方法
//int x = tabelInt[0, 0];
//長さ
//Debug.Log(arrayInt.Length);
Debug.Log(tabelInt.GetLength(0));
Debug.Log(tabelInt.GetLength(1));
for (int x = 0; x<tabelInt.GetLength(0); x++)
{
for (int y = 0; y < tabelInt.GetLength(1); y++)
{
Debug.Log(tabelInt[x,y]);
}
}
for (int y = 0; y < tabelInt.GetLength(1); y++)
{
for (int x = 0; x < tabelInt.GetLength(0); x++)
{
Debug.Log(tabelInt[x, y]);
}
}
}
}