I am still a bit new to c#/unity, and I would like to dynamically create a 2d char array. So I have an object(levelLoader) with a mostly working script below.
This is functional, but is not dynamic, and a massive kludge. Is can someone help me out?
The text file is nothing by simply chars with a end of line char '/n' ... thoughts?
void Start()
{
//load the mapfile into the data line
char[] dataLine = mapFile.text.ToCharArray();
int row = 0;
int col = 0;
char[,] mapMatrix = new char[2000, 2000];
int x = 0;
int y = dataLine.Length;
while (x < y)
{
if (dataLine[x] == '
')
{
row++;
x++;
col = 0;
}
//Debug.Log(Spot0 + " " + Line0);
else
{
mapMatrix[row, col] = dataLine[x];
x++;
col++;
}
}
}