hi there!
i have a big multidimensional array like int[8,11] filled with 0/1 and I want to visualize its content in gameplay while debugging.
what is the best way to do this (in c#)? thnx!
hi there!
i have a big multidimensional array like int[8,11] filled with 0/1 and I want to visualize its content in gameplay while debugging.
what is the best way to do this (in c#)? thnx!
you can build your own multidimensional int array class(a class with one int arrays ) and call "System.Serializable" on the class. then build an array of it.
like this:
[System.Serializable]
public class MultiDimensionalInt
{
public int[] intArray;
}
Then you can build an array of it in your main class like this:
public MultiDimensionalInt[] myIntArray;
If you want a 2D vis of it (rather than the tree view you'd get in the Inspector), you could make a GUI panel and use something like GUI Textures or something which would be drawn if the array cell was true. Toolbar or Grid Select might work too.
Hey,
I stumbled in this same issue a month ago and after solving it, I have made a solution to this, now. I have made a grid view for a 2D array.
You can find it here: Unity3D - 2D Array In Inspector - YouTube
Its in c# though.
Then it show up in the Inspector, right?
– DaveAThat's right. However if you write your class in JS , it is Serializable by default.
– AliAzin