I've created a new project to test scripts based on the topics I write. to apply to real projects. But I don't know how to do it...
I have an object called Pad, it is Prefab, and I want it to be cloned according to the string below.
string levelI = "0000000"
"0000000"
"0111110"
"0111110"
"0111110"
"0111110"
"0011100"
"0010100"
"0010100"
"0011100"
"0011100";
//Oh, another requirement is how to extract strings from other files
to be in this format after game start
Ah yes, a game page like this looks like a certain game. But this is just an example of what I would like to do from an actual project...
Thank You
CodePudding user response:
You want an array of 11 rows and 7 columns so you input should be
string[] levelI = {
"0000000",
"0000000",
"0111110",
"0111110",
"0111110",
"0111110",
"0011100",
"0010100",
"0010100",
"0011100",
"0011100"
};
foreach(string row in levelI)
{
//add row new row of buttons
for(int col = 0; col < 7; col )
{
char digit = row[col];
}
}