Hello there,
I'm trying to connect user to photon with playfab connection and join or create a room but I've an issue: "JoinOrCreateRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster."
My C# code:
public string PlayFabAppId = "My_TitleID"; string PlayFabId; // Use this for initialization void Start () { PlayFabSettings.TitleId = PlayFabAppId; PlayFabAndPhotonLogin (); } void PlayFabAndPhotonLogin() { var request = new LoginWithPlayFabRequest { TitleId = PlayFabAppId, Username = "My_UserName", Password = "My_PassWord" }; PlayFabClientAPI.LoginWithPlayFab(request, (success) => { PlayFabId = success.PlayFabId; Debug.Log("Login to Playfab: " + PlayFabId); GetPhotonToken(); }, (error) => { Debug.LogError("Login error: " + error.GenerateErrorReport()); }); } void GetPhotonToken() { GetPhotonAuthenticationTokenRequest request = new GetPhotonAuthenticationTokenRequest(); request.PhotonApplicationId = PhotonNetwork.PhotonServerSettings.AppID.Trim(); Debug.Log("Getting auth token.."); PlayFabClientAPI.GetPhotonAuthenticationToken(request, (success) => { string photonToken = success.PhotonCustomAuthenticationToken; Debug.Log(System.String.Format("Auth token success: {0}", photonToken)); PhotonNetwork.AuthValues = new AuthenticationValues(); PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Custom; PhotonNetwork.AuthValues.AddAuthParameter("username", PlayFabId); // expected by PlayFab custom auth service PhotonNetwork.AuthValues.AddAuthParameter("token", photonToken); // expected by PlayFab custom auth service PhotonNetwork.ConnectUsingSettings(PhotonNetwork.gameVersion); //Connect to the Photon Master server like we would normally do RoomOptions roomOptions = new RoomOptions(); roomOptions.IsVisible = false; roomOptions.MaxPlayers = 4; PhotonNetwork.JoinOrCreateRoom("testRoom", roomOptions, TypedLobby.Default); }, (error) => { Debug.Log(error.ErrorMessage); }); } }
Thanks,
Sblouf