Hi, Im working on a multiplayer unity survival project.Its working great and smoothly and stuff. But when i exit unity editor this morning and opened it again now, the NetworkManager got messed up. Im new to Photon and watched quill18creates tutorials and got the networkmanager from him. the problem is, The MouseLook dosen’t get enabled on start. I have tried everything. Heres the script:
using UnityEngine;
using System.Collections.Generic;
public class NetworkManager : MonoBehaviour {
public GameObject standbyCamera;
SpawnSpot[] spawnSpots;
public bool offlineMode = false;
bool connecting = false;
List<string> chatMessages;
int maxChatMessages = 5;
// Use this for initialization
void Start () {
spawnSpots = GameObject.FindObjectsOfType<SpawnSpot>();
PhotonNetwork.player.name = PlayerPrefs.GetString("Username", "Username_here");
chatMessages = new List<string>();
}
void OnDestroy() {
PlayerPrefs.SetString("Username", PhotonNetwork.player.name);
}
public void AddChatMessage(string m) {
GetComponent<PhotonView>().RPC ("AddChatMessage_RPC", PhotonTargets.AllBuffered, m);
}
[RPC]
void AddChatMessage_RPC(string m) {
while(chatMessages.Count >= maxChatMessages) {
chatMessages.RemoveAt(0);
}
chatMessages.Add(m);
}
void Connect() {
PhotonNetwork.ConnectUsingSettings( "Parkour tests" );
}
void OnGUI() {
GUILayout.Label( PhotonNetwork.connectionStateDetailed.ToString() );
if(PhotonNetwork.connected == false && connecting == false ) {
GUILayout.BeginArea( new Rect(0, 0, Screen.width, Screen.height) );
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
GUILayout.Label("Username: ");
PhotonNetwork.player.name = GUILayout.TextField(PhotonNetwork.player.name);
GUILayout.EndHorizontal();
if( GUILayout.Button("Offline") ) {
connecting = true;
PhotonNetwork.offlineMode = true;
OnJoinedLobby();
}
if( GUILayout.Button("Connect") ) {
connecting = true;
Connect ();
}
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
if(PhotonNetwork.connected == true && connecting == false) {
GUILayout.BeginArea( new Rect(0, 0, Screen.width, Screen.height) );
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
foreach(string msg in chatMessages) {
GUILayout.Label(msg);
}
GUILayout.EndVertical();
GUILayout.EndArea();
}
}
void OnJoinedLobby() {
Debug.Log ("OnJoinedLobby");
PhotonNetwork.JoinRandomRoom();
}
void OnPhotonRandomJoinFailed() {
Debug.Log ("OnPhotonRandomJoinFailed");
PhotonNetwork.CreateRoom( null );
}
void OnJoinedRoom() {
Debug.Log ("OnJoinedRoom");
connecting = false;
SpawnMyPlayer();
}
void SpawnMyPlayer() {
AddChatMessage("Spawning player: " + PhotonNetwork.player.name);
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.SetActive(false);
((MonoBehaviour)myPlayerGO.GetComponent("FPSInputController")).enabled = true;
((MonoBehaviour)myPlayerGO.GetComponent("MouseLook")).enabled = true;
((MonoBehaviour)myPlayerGO.GetComponent("CharacterMotor")).enabled = true;
myPlayerGO.transform.FindChild("Main Camera").gameObject.SetActive(true);
}
}
The Full error is this: NullReferenceExeption: Object reference is not set to a Instance of an object.
NetworkManager.SpawnMyPlayer()(at Assets/NetworkManager.cs:123) which is the MouseLook Line 
hello
on myPlayerGO do you have the MouseLook script attached? else you need to AddComponent().
you only have one “NullReference” error or more? to be sure, give also the line please.
regards