Question by
Moung georges · Jun 08, 2016 at 11:51 PM ·
networkinginstantiatenetworkphotoncloud
i can't see other player with photon cloud server,I Can't see each other player in photon cloud
It's been two weeks, i'm searching how to resovolve the problem( when i connect to player using to test the game, they can't see each other like if they weren't in the same server. here is my script. (i'm new in unity ).
using UnityEngine; using System.Collections;
public class NetworkManager : Photon.MonoBehaviour {
public Camera standbyCamera;
SpawnSpot[] spawnSpots;
// Use this for initialization
void Start () {
spawnSpots = GameObject.FindObjectsOfType<SpawnSpot> ();
Connect ();
}
void Connect() {
PhotonNetwork.ConnectUsingSettings ("0.1");
PhotonNetwork.offlineMode = true;
}
void OnGUI() {
GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());
}
void OnConnectedToMaster () {
Debug.Log ("Starting Connection");
PhotonNetwork.JoinRandomRoom ();
}
void OnPhotonRandomJoinFailed(){
Debug.Log ("Connection Failed");
PhotonNetwork.CreateRoom( null );
}
void OnJoinedRoom(){
Debug.Log ("Connect to Server");
SpawnMyPlayer ();
}
void SpawnMyPlayer() {
if (spawnSpots == null) {
Debug.LogError ("WTF?!?!?");
return;
}
SpawnSpot mySpawnSpot = spawnSpots[ Random.Range (0,spawnSpots.Length) ];
GameObject myPlayerGO = (GameObject) PhotonNetwork.Instantiate ("PlayerController", mySpawnSpot.transform.position, mySpawnSpot.transform.rotation, 0);
standbyCamera.enabled = false;
myPlayerGO.GetComponentInChildren<CharacterController>().enabled = true;
myPlayerGO.GetComponentInChildren<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>().enabled = true;
myPlayerGO.GetComponentInChildren<Camera>().enabled = true;
myPlayerGO.GetComponentInChildren<AudioListener>().enabled = true;
}
}
,
Comment