如何在 Unity 3D、2D 编辑器 MonoDevelop 中使用 Debug.Log() 在一行中打印 **********
How to print ********** in a single line by using Debug.Log() in MonoDevelop, a Unity 3D, 2D editor
我要打印
*****
*****
*****
*****
*****
通过使用 monoDevelop 的 Debug.Log() 在统一控制台中使用 for 循环。这是我的代码:
for(int row=1;row<=5;row++)
{
for(int column=1; column<=5;column++)
{
Debug.Log("*");
}
}
但是它以这种方式显示输出:
*
*
*
*
*
till 25 rows.
每次调用 Debug.Log()
都是一个新行
如果您想记录一行您需要将其连接成一个字符串的任何内容,然后 Log()
该字符串。
for(int row=1;row<=5;row++)
{
string str = "";
for(int column=1; column<=5;column++)
{
str += "*";
}
Debug.Log(str);
}