Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Third Party Photon server issues

Discussion in 'Multiplayer' started by donotprikel, Dec 15, 2023.

  1. donotprikel

    donotprikel

    Joined:
    Nov 14, 2022
    Posts:
    26
    I have unity editor 2022.3,15f1 and test build for photon pun 2.

    Getting error " JoinRoom failed. Client is on GameServer (must be Master Server for matchmaking) and ready. Wait for callback: OnJoinedLobby or OnConnectedToMaster. "

    I know some people would say Im telling it what server to connect to and im alredy in a game server that im alredy in a room. Yes but it always connects to the game server EVEN WITH CURENT SETTINGS.

    I have never gotted to connect to the master server for room creation even with about 20 tutorials and diferent scripts even ones made by photon. I cannot get the game to connect to the master server EVER!!!

    Code (CSharp):
    1. using UnityEngine;
    2. using Photon.Pun;
    3. using Photon.Realtime;
    4.  
    5. public class ConnectToPhotonNetwork : MonoBehaviourPunCallbacks
    6. {
    7.     private bool isConnecting = false;
    8.     public GameObject screen1;
    9.     public GameObject loadingEffect;
    10.     public GameObject lobbyScreen;
    11.  
    12.     private void Start()
    13.     {
    14.         // Set the log level for debugging (optional)
    15.         PhotonNetwork.LogLevel = PunLogLevel.Full;
    16.     }
    17.  
    18.     public void ConnectToPhoton()
    19.     {
    20.         Invoke("DelayedConnectToPhoton", 2f);
    21.     }
    22.  
    23.     // Method to be called when you want to connect to Photon Network
    24.     private void DelayedConnectToPhoton()
    25.     {
    26.         if (!PhotonNetwork.IsConnected && !isConnecting)
    27.         {
    28.             isConnecting = true;
    29.  
    30.             loadingEffect.gameObject.SetActive(true);
    31.  
    32.             // Connect to Photon Realtime
    33.             PhotonNetwork.NickName = MasterManager.GameSettings.NickName;
    34.             PhotonNetwork.GameVersion = MasterManager.GameSettings.GameVersion;
    35.             PhotonNetwork.ConnectUsingSettings();
    36.         }
    37.         screen1.gameObject.SetActive(true);
    38.     }
    39.  
    40.     // Callback when connected to Photon server
    41.     public override void OnConnectedToMaster()
    42.     {
    43.         Debug.Log($"Connected to Photon Server in region {PhotonNetwork.CloudRegion}!");
    44.         isConnecting = false;
    45.         loadingEffect.gameObject.SetActive(false);
    46.         lobbyScreen.gameObject.SetActive(true);
    47.         print(PhotonNetwork.LocalPlayer.NickName);
    48.         PhotonNetwork.JoinLobby();
    49.     }
    50.  
    51.     // Callback when failed to connect to Photon server
    52.     public override void OnDisconnected(DisconnectCause cause)
    53.     {
    54.         Debug.LogWarningFormat("Disconnected from Photon Server. Reason: {0}", cause);
    55.         isConnecting = false;
    56.     }
    57. }
    58.  


    also video https://i.imgur.com/QlkkNvE.mp4
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,082
    The console log file would help a lot more than the video, which is grainy as heck. Can't read the console, sorry.
    Enable the SupportLogger in the PhotonServerSettings file. Run and post the console log as attached file.

    Unsolicited tip: Don't use "grouping" in the console. It is terrible for understanding things that happen in some order.
     
  3. donotprikel

    donotprikel

    Joined:
    Nov 14, 2022
    Posts:
    26
    Here i dont know why the video turned to low quality even though i had it set to high on my computer.

     

    Attached Files:

  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,082
    As said: Please enable the SupportLogger. I am missing important details here.