- Home /
Boo: Set Values of muldimensional array when defining
Hey Guys, because I really hate the Syntax of the C# language I changed my scripts to Boo. Everything got converted, except the multidimensional arrays. I searched google, and the boo documentation, but I haven't found a way to set the values of an array when defining! In C# it looks like that:
public static int[, ,] textures = new int[,,] {
// top north east south west bottom
{ {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0} }, // stone id=1
{ {1,0}, {1,0}, {1,0}, {1,0}, {1,0}, {1,0} }, // dirt id=2
{ {3,0}, {2,0}, {2,0}, {2,0}, {2,0}, {1,0} }, // grass id=3
{ {4,0}, {4,0}, {4,0}, {4,0}, {4,0}, {4,0} } // glass id=4
};
Do you know how I could achieve that?
And please excuse my grammar mistakes, I'm still learning :)
Answer by yxyx136 · Sep 06, 2014 at 10:36 PM
Solved it now myself using an nested array like that: public static textures as (((int))) = ( ((0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)), ((1, 0), (1, 0), (1, 0), (1, 0), (1, 0), (1, 0)), ((3, 0), (2, 0), (2, 0), (2, 0), (2, 0), (1, 0)) )
Your answer
![](https://koobas.hobune.stream/wayback/20220613162354im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Arrays In Classes? 2 Answers
String.Split problem 1 Answer
Array Help GameObject Length Inventory 1 Answer
What am I doing wrong on my array? 4 Answers