Spawns extra player?

Options
I'm tearing my hair out, it is consistently spawning an extra player. One server, one client, yet it spawns 3 players and essentially "orphans" the rogue 3rd player.

I get this error message: OnDestroy for PhotonView View (0)2001 on Player_Net(Clone) but GO is still in instantiatedObjects. instantiationId: 2001. Use PhotonNetwork.Destroy(). Loading new scene caused this. Identical with this: True PN.Destroyed called for this PV: True

Not sure if that's causing it though, that is referring to View Id 2001 presumably, which doesn't actually exist in the game.

Once the level is loaded, it creates player1, whose PhotonView says it's controlled by the server, gets a viewid of 2002. Ok, great!

It then creates player2 and player3, whose PhotonViews say they're both controlled by a client (not great as there's only one client), and get viewid's of 1001 and 1002. It is the 1001 that gets orphaned, the client can actually control 1002.

Any idea why on earth it's doing this? Driving me insane!

Comments

  • Tobias
    Options
    If each client should spawn one character, then PhotonView IDs should be 1001 and 2001. If you get 1002, your first client does not stop instantiating characters, it seems.
    Also note that loading levels after Instantiate is going to delete whatever you instantiated. Including networked characters.
    I can't debug your client's behaviour but you can work through the Marco Polo tutorial (again). It shows how to instantiate one char per client.
    http://doc.exitgames.com/photon-cloud/M ... o_Tutorial
  • skeptika
    Options
    It turned out to be an Awake vs Start problem.

    I was using the instantiation method as prescribed in Marco Polo, but I was calling it via Awake. Moving it to Start fixed it.

    Face palmingly stupid but at least I figured it out.
  • Tobias
    Options
    Ow, that's mean. Good you found it!
    Thanks for the update.