Player duplicating when client joins room

Options

Hello,

I'm having an issue when I'm testing my game on iOS build, where a client joining the room causes:

a) a duplicate of the host to be created in the host game, can't see the client

b) a duplicate of the client also created, can't be the host, different game being played then host game


I've searched all around in this forum and everywhere else on the internet. I've seemingly tried every solution to this but the same thing keeps happening. No error codes occur or anything unusual in the console. Have compiled the assembly anytime I've changed anything. In case it helps also, the debugger shows 2 entities are indeed active.


Here's my code for starting the server/client:

public void StartServer()

  {

    BoltLauncher.StartServer();

  }

  public override void BoltStartDone()

  {

    if (BoltNetwork.IsServer) 

    {

      BoltMatchmaking.CreateSession(sessionID: "online level", sceneToLoad: "10_online_level");

    }

  }

  public void StartClient()

  {

    BoltLauncher.StartClient();

  }

  public override void SessionListUpdated(Map<Guid, UdpSession> sessionList)

  {

    foreach (var session in sessionList)

    {

      UdpSession photonSession = session.Value as UdpSession;

      if (photonSession.Source == UdpSessionSource.Photon)

      {

        BoltMatchmaking.JoinSession(photonSession);

      }

    }

  }


And here is my network callbacks code:

[BoltGlobalBehaviour]

public class NetworkCallbacks :Photon.Bolt. GlobalEventListener

{

  public override void SceneLoadLocalDone(string scene, IProtocolToken token)

  {

    var spawnPosition = new Vector3(Random.Range(-8, 8), 0, Random.Range(-8, 8));

    BoltNetwork.Instantiate(BoltPrefabs.userObj, spawnPosition, Quaternion.identity);

  }

}


Let me know if there's something I can change or what might cause this.


Thanks,


-Kjay