Is OnConnectedToMaster called?
Options
FBI
✭
First off, I'm on Unity 2018.1.2f1. I've implemented a simple button, which I use to connect to the Photon Cloud.
What am I missing? Thank you!
public void connectToPhoton() { PhotonNetwork.ConnectUsingSettings(version); Debug.Log("[DEBUG] Connecting to the Photon server..."); } private void OnConnectedToMaster() { PhotonNetwork.JoinLobby(TypedLobby.Default); Debug.Log("[DEBUG] Connection to the Photon server has been successfully established."); } private void OnJoinedLobby() { introView.SetActive(false); connectionView.SetActive(false); lobbyView.SetActive(true); // <= This is where I switch views to show that I have connected successfully Debug.Log("[DEBUG] Player entered the lobby."); }The view switch doesn't happen, though. From the logs I can see that I am indeed connected:
Connected to masterserver.
UnityEngine.Debug:Log(Object)
NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2096)
ExitGames.Client.Photon.PeerBase:InitCallback()
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:158)
UnityEngine.Debug:Log(Object)
NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2096)
ExitGames.Client.Photon.PeerBase:InitCallback()
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:158)
What am I missing? Thank you!
0
Comments
-
Hi @FBI,
have you enabledPhotonNetwork.autoJoinLobby
? In this caseOnConnectedToMaster()
won't be called, insteadOnJoinedLobby()
is called. Am I right in assuming that this is not called either? Which of your Debug.Log calls are actually logged to the console?0 -
Hi, thanks for trying to help! I have found out the issue. I'll post it for future reference: The connection could not be established because I disabled the button right after it tried to connect, therefore also disabling the script.0