我有用Unity3D C#編寫的代碼。問題是我有Unity 5,代碼是爲舊版本編寫的,所以有些東西我必須替換,因爲它們已經過時。隨着folloiwng代碼:替換小c犀利貶值
if (Input.GetMouseButton (1) && (!requireLock || controlLock || Screen.lockCursor))
// If the right mouse button is held, rotation is locked to the mouse
{
if (controlLock)
{
Screen.lockCursor = true;
}
rotationAmount = Input.GetAxis ("Mouse X") * mouseTurnSpeed * Time.deltaTime;
}
else
{
if (controlLock)
{
Screen.lockCursor = false;
}
}
我得到的錯誤:
CS0618:
UnityEngine.Screen.lockCursor' is obsolete:
Property lockCursor has been deprecated. Use Cursor.lockState and Cursor.visible instead.'
如果我將與lockState取代lockCursor它無法正常工作。
如何正確更新過時的代碼?
設法進行適當的替代自己,那麼如果它不後的代碼工作,你會得到幫助。 – Shar1er80
你是什麼意思,「如果我將鎖lockCursor鎖lockCursor不工作。」? –