MenuNetwork.SpawnMyPlayer() (at Assests\scripts\MenuNetwork.cs:34
using UnityEngine;
using System.Collections;
public class MenuNetwork : Photon.MonoBehaviour {
public GameObject spawnPos;
public GameObject _StandbyCamera;
void Start () {
PhotonNetwork.ConnectUsingSettings("0.1");
}
void OnGUI () {
GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
}
void OnJoinedLobby() {
PhotonNetwork.JoinRandomRoom();
}
void OnPhotonRandomJoinFailed() {
PhotonNetwork.CreateRoom(null);
}
void OnJoinedRoom() {
Debug.Log ("Connected to Room");
SpawnMyPlayer();
}
void SpawnMyPlayer() {
GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate("Player", spawnPos.transform.position, spawnPos.transform.rotation, 0);
_StandbyCamera.SetActive(false);
((MonoBehaviour)myPlayerGO.GetComponent("MouseLook")).enabled = true;
((MonoBehaviour)myPlayerGO.GetComponent("CharacterMotor")).enabled = true;
((MonoBehaviour)myPlayerGO.GetComponent("PlayerGUI")).enabled = true;
myPlayerGO.transform.FindChild("Main Camera").gameObject.SetActive(true);
}
}