Search Unity

Third Party PhotonNetwork leaving scene errors

Discussion in 'Multiplayer' started by RyanPaterson, Jul 26, 2014.

  1. RyanPaterson

    RyanPaterson

    Joined:
    Dec 14, 2013
    Posts:
    77
    Hey,
    I'm really new to Photon, but i've struggled to find tutorials on leaving the rooms/scenes you've made.
    So if anyone knows of one that covers it i'd love to read it.

    My problem is that when I finish the level, I call a function that removes the player from the room and then brings him back to the menu scene. I'm using this simple method to do so:

    Code (csharp):
    1.  
    2.    voidLeaveRoom()
    3.  {
    4.  
    5. PhotonNetwork.LeaveRoom ();
    6.  
    7. Application.LoadLevel (0);
    8.  
    9.  }
    10.  
    I've attached an image of the error, annoyingly it doesn't point to a specific object or line of code, so I'm not sure what my problem is.

    Regardless of the error though, it does remove me from the level...

    Thanks in advance!
     

    Attached Files:

  2. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    You should not use the LeaveRoom and LoadLevel in same method. Call LeaveRoom and then in its callback function you should call LoadLevel.
     
  3. RyanPaterson

    RyanPaterson

    Joined:
    Dec 14, 2013
    Posts:
    77
    That worked an absolute treat!
    Thanks for taking the time to reply.
     
  4. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    No problem.