void Start()
{
for (int y = 0; y < 5; y++)
{
for (int x = 0; x < 6; x++)
{
Debug.Log(“x:” + x);
}
Debug.Log(“y:” + y);
}
}
Some reason this code displays x = 1, 2, 3… then y = 1, 2, 3…
void Start()
{
for (int y = 0; y < 5; y++)
{
for (int x = 0; x < 6; x++)
{
Debug.Log(“x:” + x);
}
Debug.Log(“y:” + y);
}
}
Some reason this code displays x = 1, 2, 3… then y = 1, 2, 3…
What are you expecting it to display?
Please use code tags .
Since you haven’t given much information, I guess you only see the console logging x first, then only y? Make sure to uncheck ‘collapse’ in the console, as this stacks logs that are equal to some extent.
As written it will run through all the X Debug.Log lines, then a single Y Debug.Log line, all the X’s again, then 1 Y, etc, etc. You should state what you actually wanted. We can’t read minds.