多次元配列がInspectorに表示されない Unity C#
以下のような2種類の配列の変数をInspectorに表示したい。
・「配列の配列(ぎざぎざ配列)」、別名「Jagged Array」
public int[][] jug = { new[] { 1 }, new[] { 2, 3, 4 }, };
・「多次元配列(Rectangular Array)」、別名「四角い配列」
※「配列の配列」と区別するため「四角い多次元配列」という
public int[,] rect = { { 1, 2 }, { 3, 4 }, };
↓このようにクラス名の上にシリアライズしてもダメだった
[System.Serializable] public class HogeClass: MonoBehaviour {
↓インナークラスを作ってそれをpublicにしてみたがダメだった
[System.Serializable] public class Inner { public int[][] jug = { new[] { 1 }, new[] { 2, 3, 4 }, }; public int[,] rect = { { 1, 2 }, { 3, 4 }, }; } public Inner inner;