Search Unity

Third Party Photon Pun simple callback question

Discussion in 'Multiplayer' started by larswik, Apr 21, 2019.

  1. larswik

    larswik

    Joined:
    Dec 20, 2012
    Posts:
    312
    Hey All, I am rewriting a game to include Multiplayer. I have Pun basically working and had a question. When both players are in a room the count down happens and then the
    Code (CSharp):
    1. PhotonNetwork.LoadLevel("GameLevel");
    is called. The game loads for both players, but it is not the same time for both players. There is some code I want to write, but I need the second player to load and have their PlayerPrefab show up so I want to delay until they are loaded. What call back does Pun have once in the actual game when both players are fully loaded?

    Thanks!
     
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    There isn't a built-in callback for this.

    You could have the master client run something like a co-routine that continually checks to see if both players have loaded their prefabs and then when they are both loaded it can continue with what you want to happen.
     
  3. larswik

    larswik

    Joined:
    Dec 20, 2012
    Posts:
    312
    Munchy2007, thanks for the reply. Can you answer this question for me. is the photon 'ROOM' the room where the game is played, or the meeting room before you launch the game? When the player leaves the game this must trigger some callback method for instance. I can see things like player left room calbacks but player left game? I think understanding what a lobby and room really are would be a great help. Thanks!
     
  4. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    The Room is where the game is played, and you can get info about players entering and leaving the room (game) if you implement the IInRoomCallbacks interface.

    The Lobby is an intermediate state of connection whereby you are connected to the PhotonCloud server, but aren't yet in a game (Room). Whilst in the lobby you can get a list of all the rooms that are currently available to be joined.
     
    tobiass likes this.
  5. larswik

    larswik

    Joined:
    Dec 20, 2012
    Posts:
    312
    Thank you. That answer right there was what I was looking for. Now things make more sense to me.
     
    Munchy2007 likes this.