Hello Unity Users.
I’m trying to make an simple Multiplayer FPS and i want to activated my Camera trough script… I’ve made one script but this does not work.
using UnityEngine;
using System.Collections;
public class NetworkManager : MonoBehaviour {
void Start () {
Connect();
}
void Connect() {
PhotonNetwork.ConnectUsingSettings( "Project LuPaLu v001" );
}
void OnGUI() {
GUILayout.Label( PhotonNetwork.connectionStateDetailed.ToString() );
}
void OnJoinedLobby() {
PhotonNetwork.JoinRandomRoom();
}
void OnPhotonRandomJoinFailed() {
PhotonNetwork.CreateRoom( null );
}
void OnJoinedRoom() {
Debug.Log("Room Joined");
SpawnPlayer();
}
void SpawnPlayer() {
GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate("PlayerController 1", Vector3.zero, Quaternion.identity, 0);
Debug.Log(myPlayerGO);
((MonoBehaviour)myPlayerGO.GetComponent("PlayerMovement")).enabled = true;
((MonoBehaviour)myPlayerGO.GetComponent("MouseLook")).enabled = true;
myPlayerGO.transform.FindChild("Main Camera").gameObject.SetActive(true);
}
}
Thanks for your Help.