- Home /
Problem with UFPS and photon
Hi guys, so i was working on a multiplayer fps with UFPS and photon network, everything seems to be good until I disable the Vp_FPController and FPSCamera components and enable them only for “my” player instance. So i wrote this :
void SpawnPlayer()
{
GameObject PlayerGO = PhotonNetwork.Instantiate("PlayerPrefab", new Vector3(1000,0,1000), Quaternion.identity, 0);
Vp_FPController controllerGO = PlayerGO.GetComponent<Vp_FPController>();
controllerGO.enabled = true;
FPSCamera cameraGO = PlayerGO.GetComponent<FPSCamera>();
cameraGO.enabled = true;
}
I got those errors
Assets/Scripts/NetWorkManager.cs(47,17): error CS0246: The type or namespace name
Vp_FPController' could not be found. Are you missing a using directive or an assembly reference? > Assets/Scripts/NetWorkManager.cs(49,17): error CS0246: The type or namespace name
FPSCamera' could not be found. Are you missing a using directive or an assembly reference?
Any solution ? thanks.
Answer by Mastasytha · Jul 14, 2014 at 02:26 PM
void SpawnPlayer() { GameObject PlayerGO = PhotonNetwork.Instantiate("PlayerPrefab", new Vector3(1000,0,1000), Quaternion.identity, 0); if(PhotonView.isMine == true) { Vp_FPController controllerGO = PlayerGO.GetComponent(); controllerGO.enabled = true; FPSCamera cameraGO = PlayerGO.GetComponent(); cameraGO.enabled = true; } else if(photonView.isMine == false) { Vp_FPController controllerGO = PlayerGO.GetComponent(); controllerGO.enabled = false; FPSCamera cameraGO = PlayerGO.GetComponent(); cameraGO.enabled = false; } }