Photon unity issues

Im trying to get this code to work but it just keeps giving me this error for no reason:

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

here is my code:

using UnityEngine;
using System.Collections;

public class PlayerSpawn : MonoBehaviour {

	public GameObject player;
	public GameObject SpawnPoint;
	// Use this for initialization
	void Start () 
		MyPlayer ();
	// Update is called once per frame
	void Update () 

	void MyPlayer()
		GameObject MyPlayerInGame =(GameObject) PhotonNetwork.Instantiate ("soldier3rdPerson 1",SpawnPoint.transform.position,SpawnPoint.transform.rotation,0);
		((MonoBehaviour)MyPlayerInGame.GetComponent ("Soldier Movement")).enabled = true;
		((MonoBehaviour)MyPlayerInGame.GetComponent ("Crouch Controller")).enabled = true;
		((MonoBehaviour)MyPlayerInGame.GetComponent ("Skeleton To Character")).enabled = true;
		((MonoBehaviour)MyPlayerInGame.GetComponent ("Soldier LOD")).enabled = true;
		((MonoBehaviour)MyPlayerInGame.GetComponent ("Health")).enabled = true;
		((MonoBehaviour)MyPlayerInGame.GetComponent ("Trigger Children Collider")).enabled = true;


Drag your Player game object to your player variable in this script in inspector window. this error will disappear . or find this using tag or name in start

start() {
player = GameObject.FindGameobjectWithTag("your tag");

This is because you’re referencing SpawnPoint in your instantiate statement, but haven’t set SpawnPoint to anything. This means the Instantiate is trying to put your player at the position of an undefined GameObject (hence the error of an object reference not being set to an instance of an object).

To solve this, you’ll need to do something along the lines of:

SpawnPoint = GameObject.FindGameObjectWithTag("SpawnPoint");