Why the following code will show “QWE” only once:
for (int i = 0; i < 2; i++) {
Debug.Log(“QWE”);
}
But this code will show QWE1, QWE2:
for (int i = 0; i < 2; i++) {
Debug.Log(“QWE” + i);
}
Why the following code will show “QWE” only once:
for (int i = 0; i < 2; i++) {
Debug.Log(“QWE”);
}
But this code will show QWE1, QWE2:
for (int i = 0; i < 2; i++) {
Debug.Log(“QWE” + i);
}
You probably have the ‘collapse’ button on the console activated. It can lead to disorienting behavior like that.
None of those show what you say they do. ![]()
I just copy pasted, no edits, the lines you posted into an otherwise empty Start function:
void Start()
{
for (int i = 0; i < 2; i++) { Debug.Log("QWE"); }
for (int i = 0; i < 2; i++) { Debug.Log("QWE" + i); }
}
And they output this:
QWE
QWE
QWE0
QWE1
This is my screen shot http://www.2shared.com/photo/aGAJBLIw/issue.html. I guess I have some setting in my unity editor which cause this behaviour.
– anon83631402That's exactly it (what Ray Pendergraph said). Your collapse button is preventing both cases of QWE from displaying, because it removes identical entries. Here's what the same code looks like in my Unity: http://img265.imageshack.us/img265/8943/qwetest.png
– CHPedersen