OnLeftRoom dont call right i think

Hi there,

im currently at the PUN Basic Tutorial Part 4 and i supose not get the right Log Messages after the second client leave the room.

This is what i get in the console:

HandleEventLeave for player ID: 2 evLeave: Event 254: {(Byte)252=(Int32[])System.Int32[], (Byte)254=(Int32)2}
UnityEngine.Debug:Log(Object)
NetworkingPeer:HandleEventLeave(Int32, EventData) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1298)
NetworkingPeer:OnEvent(EventData) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2452)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)

This is my code snippet from GameManager.cs
public override void OnLeftRoom()
		{
			Debug.Log ("DemoAnimator/Launcher: OnLeftRoom() was called by PUN");

			SceneManager.LoadScene("Launcher");

		}
I supose to get the "DemoAnimator/Launcher: OnLeftRoom() was called by PUN" message and not the HandleEventLeave log.

Is there something wrong going on?

I use the unity3d version 2017.1.1f1 and the current version of PUN

Best regards
Chris

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi Chris (@Sillixx),

    Thank you for choosing Photon!

    OnLeftRoom is for local actor. See doc-api link.
    OnPhotonPlayerDisconnected is for remote actor. See doc-api link.
  • Hi @JohnTube
    thank you, now i get it.
    But there is one thing it might not work right.

    This is my whole GameManager.cs
    using System;
    using System.Collections;
    
    using UnityEngine;
    using UnityEngine.SceneManagement;
    
    namespace Com.SilliXGames.PUNBasicTutorial
    {
    	public class GameManager : Photon.PunBehaviour
    	{
    
    		#region Photon Messages
    
    		public override void OnPhotonPlayerConnected(PhotonPlayer other)
    		{
    			Debug.Log("OnPhotonPlayerConnected() " + other.NickName); // not seen if you are the player connecting
    
    			if (PhotonNetwork.isMasterClient)
    			{
    				Debug.Log("OnPhotonPlayerConnected isMasterClient " + PhotonNetwork.isMasterClient); // called before OnPhotonPlayerDisconnected
    
    				LoadArena();
    			}
    		}
    
    		public override void OnPhotonPlayerDisconnected(PhotonPlayer other)
    		{
    			Debug.Log("OnPhotonPlayerDisconnected() " + other.NickName); // seen when other disconnects
    
    			if (PhotonNetwork.isMasterClient)
    			{
    				Debug.Log("OnPhotonPlayerDisconnected isMasterClient " + PhotonNetwork.isMasterClient); // called before OnPhotonPlayerDisconnected
    
    				LoadArena();
    			}
    		}
    
    		// <summary>
    		/// Called when the local player left the room. We need to load the launcher scene.
    		/// </summary>
    		public override void OnLeftRoom()
    		{
    			Debug.Log ("DemoAnimator/Launcher: OnLeftRoom() was called by PUN");
    
    			SceneManager.LoadScene("Launcher");
    
    		}
    
    		#endregion
    
    		#region Public Methods
    
    		public void LeaveRoom()
    		{
    			Debug.Log ("DemoAnimator/Launcher: LeaveRoom() was called by PUN");
    
    			PhotonNetwork.LeaveRoom();
    		}
    
    		#endregion
    
    		#region Private Methods
    
    		void LoadArena()
    		{
    			if (!PhotonNetwork.isMasterClient)
    			{
    				Debug.LogError("PhotonNetwork: Trying to load a level but we are not the master client");
    			}
    			Debug.Log("PhotonNetwork: Loading Level : " + PhotonNetwork.room.PlayerCount);
    			PhotonNetwork.LoadLevel("Room for " + PhotonNetwork.room.PlayerCount);
    		}
    
    		#endregion
    	}
    }
    I think there should be this Log at the Hosts console when a second client join.
    Debug.Log("OnPhotonPlayerConnected() " + other.NickName); // not seen if you are the player connecting

    .. and when leaving:
    Debug.Log("OnPhotonPlayerDisconnected() " + other.NickName); // seen when other disconnects

    But i still get the HandleEventLeave log instead of my custom log. Is there something wrong?