PUN2, other player's prefab not populating in assigned field in unity editor

The game I am working on is using Photon PUN2 for online and when I use the editor and a build to test the multiplayer as player 1 and player 2. When I check in the editor the editor’s prefab is assigned as Player 1 and currentPlayer since it is the host but the build’s player prefab is not assigned as Player2 or otherPlayer in the Game Manager script fields of the editor. Is the normally the case because the Player1 prefab is instantiated on the editor and the player2 prefab is instantiated by the build? Or am I just messing up the implementation? My code works to switch currentPlayer and otherPlayer between Player1 and Player2 when I drag the Player2 prefab in the hierarchy to the field Player2 and otherPlayer but this is not a workable solution to play the game. I appreciate any help, the code for the GameManager script is below.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
using Photon.Realtime;
using System.IO;
using TMPro;
using System.Linq;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviourPunCallbacks

public static GameManager instance;

public GameObject Creature01;
public GameObject Creature02;
public GameObject Creature03;
public GameObject Creature04;
public GameObject Creature05;

public GameObject Creature06;
public GameObject Creature07;
public GameObject Creature08;
public GameObject Creature09;
public GameObject Creature10;

public GameObject Hercules;
public GameObject Thor;
public GameObject Horus;
public GameObject KingArthur;
public GameObject Merlin;
public GameObject Jesus;
public GameObject Mike;
public GameObject God;
public GameObject Lilith;
public GameObject Satan;


public GameObject Player1;
public GameObject Player2;
public GameObject currentPlayer;
public GameObject otherPlayer;
public GameObject tempPlayer;
public int turnnumber;
public Transform[] spawnPoints;

public  void Awake()
CreatePlayer(); //Create a networked player object for each player that loads into the multiplayer scenes.
public void Start()
turnnumber = 1;

public void SpawnCreatures()
 Debug.Log("Spawning Creatures");

if(PhotonNetwork.IsMasterClient)// If Statement that checks if player is HostMaster {MASTER = (Player 1)}
     PhotonNetwork.Instantiate(Hercules.name, new Vector3(1, 0, 1), Quaternion.identity, 0);
              PhotonNetwork.Instantiate(Thor.name, new Vector3(2, 0, 1), Quaternion.identity, 0);
                       PhotonNetwork.Instantiate(Horus.name, new Vector3(3, 0, 1), Quaternion.identity, 0);
                                PhotonNetwork.Instantiate(KingArthur.name, new Vector3(4, 0, 1), Quaternion.identity, 0);
                                         PhotonNetwork.Instantiate(Merlin.name, new Vector3(5, 0, 1), Quaternion.identity, 0);
    else// Else Statement that assigns for {CLIENT (Player 2)}
     PhotonNetwork.Instantiate(Jesus.name, new Vector3(1, 0, 8), Quaternion.identity, 0);
              PhotonNetwork.Instantiate(Mike.name, new Vector3(2, 0, 8), Quaternion.identity, 0);
                       PhotonNetwork.Instantiate(God.name, new Vector3(3, 0, 8), Quaternion.identity, 0);
                                PhotonNetwork.Instantiate(Lilith.name, new Vector3(4, 0, 8), Quaternion.identity, 0);
                                         PhotonNetwork.Instantiate(Satan.name, new Vector3(7, 0, 8), Quaternion.identity, 0);


private void CreatePlayer()
Debug.Log(“Creating Player”);

    if(PhotonNetwork.IsMasterClient)// If Statement that checks if player is HostMaster {MASTER = (Player 1)}
  Player1 =  PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PhotonPlayer"), new Vector3(0, 1, 0), Quaternion.identity);

   currentPlayer = Player1;

    else// Else Statement that assigns for {CLIENT (Player 2)}
   Player2 = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PhotonPlayer"), new Vector3(9, 1, 9), Quaternion.identity);

    otherPlayer = Player2;

public void EndTurn()
    tempPlayer = currentPlayer;
    currentPlayer = otherPlayer;
    otherPlayer = tempPlayer;

    turnnumber += 1;
     Debug.Log("Turn: " + turnnumber);

void Update()


Hey there and welcome to the forum,

i can only recommend to take a pen and paper and draw a little diagramm of what exactly happens on each players side. Make no assumption of what you think your code does in that case but really draw it as you go through the code.

You will come to realise that your code basically only takes into account what happens to the player that you instantiate yourself in your instance.

A bit further explained:

When you call create player the following will happen from player1 (masterplayer) (for now called A):

  • A instantiates it’s own playerObject.
  • A’s object will be created as uncontrollable object on Player2s end.
  • A locally assignes the object to currentPlayer

When you call create player on player2 (for now called B):

  • B instantiates it’s own playerObject.
  • B’s object will be created as uncontrollable object on A’s end.
  • B locally assignes the object to otherPlayer

Now A has set currentPlayer to its own playerObject and B has set Its own playerObject to otherPlayer.

You nowhere ever assign the respective other variable. So basically what i’d suggest for you would be the following:
Instead of having the direct assignement make the playerobject assign itself to the correct slot when it calls Awake on the object itself.

You probably have some kind of PlayerLogic script that runs on the Instantiated player.
To the awake function add something like this:

if (PhotonNetwork.IsMasterClient)
            if(photonView.IsMine())// this should check if the photonview on this object *belongs* to the localPlayer
                GameManager.instance.currentPlayer = gameObject;
                GameManager.instance.otherPlayer = gameObject;
            if (photonView.IsMine())
                GameManager.instance.otherPlayer = gameObject;
                GameManager.instance.currentPlayer = gameObject;

SideNote: Your code might end up confusing yourself as currentPlayer and otherPlayer are (at least from your current code) directly translateable to currentPlayer is equal to MasterClient and otherPlayer is equal to the non MasterClient. This works good from Player1’s point of view but might be confusing when trying to figure out code that regards Player2 as on its own end its own playerObject is to be found in otherPlayer.

Just make sure for yourself that this is how you want things to be.