Hello,
I am getting this weird nullreferenceexception, I have been trying for hours to fix it but it has been to no prevail! Anyway here is the error:

I’m pretty sure that there is a instance of the object since there is one created in the same function, here is the three snippets of code that link together to spawn my player(this is where it breaks).
void OnConnectedToServer(){
myPlayer = Network.player;
networkView.RPC("MakePlayer", RPCMode.Server, myPlayer);
}
[RPC]
void MakePlayer(NetworkPlayer thisPlayer){
Transform newPlayer = Network.Instantiate(player, transform.position, transform.rotation, 0) as Transform;
if(thisPlayer != myPlayer){
networkView.RPC("EnableCamera", thisPlayer, newPlayer.networkView.viewID);
} else {
EnableCamera(newPlayer.networkView.viewID);
}
}
[RPC]
void EnableCamera(NetworkViewID playerID){
GameObject[] players;
players = GameObject.FindGameObjectsWithTag("Player");
foreach(GameObject thisPlayer in players){
if(thisPlayer.networkView.viewID == playerID){
thisPlayer.transform.FindChild("Camera").GetComponent<Camera>().enabled = true;
thisPlayer.GetComponentInChildren<AudioListener>().enabled = true;
break;
}
}
}
The line 113 that the error message points to is the EnableCamera(newPlayer.networkView.viewID); part in the MakePlayer function.
Thanks and I look forward to hearing your earliest response.
SOLUTION
The problem was that the newPlayer was being stored as a transform when it should be stored as a GameObject.