2014-03-19 54 views
-2

我想添加速度指示器到我的遊戲,但我有一個錯誤。速度指示器unity3d

這是錯誤:

UnassignedReferenceException: The variable myWC of 'Car' has not been assigned. 

You probably need to assign the myWC variable of the Car script in the inspector. 

這是錯誤的行:

currentSpeed = (Mathf.PI*2*myWC.radius)*myWC.rpm*0/1000; 
+1

@brbcoding哈哈...你以爲? – Savlon

回答

0

需要初始化myWC爲默認值,然後才能使用它,你的代碼路徑做現在不保證。代碼片段在調試時非常有幫助。