NullRefenceException: Object reference not set to an instance of an object

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);
	}
}

so it’s this line:

((MonoBehaviour)myPlayerGO.GetComponent("MouseLook")).enabled = true;

i’d say it’s the MonoBehaviour casting, just remove (MonoBehaviour)

if the problem persists then you miss MouseLook component on myPlayerGO

If GetComponent returns null, as it does in your case, it means the desired component isn’t attached to your game object.

Also, just as a general tip, you really really really shouldn’t use strings to do GetComponent. Instead, use the generic syntax:

GetComponent<MouseLook>()

, or alternatively GetComponent(typeof(MouseLook)). That way, if you change the name of the class, these names will be updated automatically. They won’t change in your string based approach, which will in turn lead to null reference exceptions because the desired type could not be found on the game object, because it does not exist.