1
好了,所以我在Unity進行在線FPS和我的腳本是光子網絡腳本連接和產卵的球員,我不斷收到這兩個錯誤:光子網絡實例化錯誤(Unity3d)
Assets/Resources/GameManager.cs(64,23): error CS1502: The best overloaded method match for `PhotonNetwork.Instantiate(string, UnityEngine.Vector3, UnityEngine.Quaternion, int)' has some invalid arguments
Assets/Resources/GameManager.cs(64,23): error CS1503: Argument `#1' cannot convert `UnityEngine.Transform' expression to type `string'
這裏就是錯誤是在我的代碼:
// When Connected [Photon Callback]
void OnJoinedRoom()
{
PhotonNetwork.Instantiate(playerPrefab, transform.position, Quaternion.identity, 0);
}
//In Game: Disconnect from room.
void InGameGUI()
{
if (GUILayout.Button("Leave Game"))
PhotonNetwork.LeaveRoom();
}
}
而且我也引用變換頂部:
public Transform playerPrefab;
任何想法,我做錯了什麼,我怎麼能解決它。請幫忙!