如何在 Unity 3D、2D 编辑器 MonoDevelop 中使用 Debug.Log() 在一行中打印 **********

1 c# monodevelop unity-game-engine unity3d-2dtools unity5

我要打印

*****
*****
*****
*****
*****
Run Code Online (Sandbox Code Playgroud)

通过使用 monoDevelop 的 Debug.Log() 在 unity 控制台中使用 for 循环。这是我的代码:

for(int row=1;row<=5;row++)
{
  for(int column=1; column<=5;column++)
     {
         Debug.Log("*");
     }
}
Run Code Online (Sandbox Code Playgroud)

但它以这种方式显示输出:

*
*
*
*
*
till 25 rows. 
Run Code Online (Sandbox Code Playgroud)

Dra*_*18s 5

每次调用Debug.Log()都是一个新行

如果你想记录一行任何你需要将它连接成一个字符串的东西,那么Log()那个字符串。

for(int row=1;row<=5;row++)
{
    string str = "";
    for(int column=1; column<=5;column++)
    {
        str += "*";
    }
    Debug.Log(str);
}
Run Code Online (Sandbox Code Playgroud)