Create a new C# script called HelloWorld that every frame increments an int variable by 1 in the Update() method and prints it to the console using Debug.Log(), starting with 0.
? Attach this to script Empty2 and press the Play button to see the output in the Console window.
創建一個名為HelloWorld的新C#腳本,該腳本在Update()方法中每幀將一個int變數加1,然后使用Debug.Log()從0開始將其列印到控制臺。
?將其附加到腳本Empty2,然后按“播放”按鈕 在控制臺視窗中查看輸出。
uj5u.com熱心網友回復:
int index = 0;index++;
debug.log(index)
uj5u.com熱心網友回復:
public class HelloWorld : MonoBehaviour
{
private int theVariable = 0;
private void Update()
{
Debug.log( theVariable ++ );
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/9403.html
標籤:Unity3D
上一篇:Unity3.5.7崩潰
