【发布时间】:2016-08-05 20:03:55
【问题描述】:
在“Unity”中我们经常调试到控制台。
public bool printInConsole;
void Start()
{
if ( printInConsole ) Debug.Log("Starting and printing...");
}
我想使用 compact 调用这个 Unity 函数?三元运算符。
如何使用 C# 在 Unity 中为此编写语句?
【问题讨论】:
-
你的“假”案例是什么?
-
你还有别的吗?
-
不在控制台中显示。不,我没有 else
-
如果你没有 else 情况,那么你不需要三元运算符。也许你应该多解释一下你想要达到的目标......
-
不仅没有别的,而且
Debug.Log大概就是void吧?所以表达式也没有任何返回值。
标签: c# debugging if-statement unity3d ternary-operator