what it means to host a web player unity3d file on server like dropbox loading it into facebook canvas and use backend server like GameSparks

144 views Asked by At

I'm new to backend servers and hosting files so if you could give me a starting point just to undersand how it works.

If I can log in with a facebook profile somehow this data saved in the dropbox and if I try to log in again with a different profile I face this "The current user has a Facebook profile and it’s not the profile they have just tried to log in with" this from the GameSparks documentation which turns into error <"accessToken":"ACCOUNT_ALREADY_LINKED">recieved from GameSparks

1

There are 1 answers

0
Fadi Bakoura On

Solved after 12 hours I discovered that u have to disconnect from the server and reconnect forexample when you want to link a facebook profile the server is now connected to that user so when you want to link another profile u have to disconnect from the previous profile and connect then wait till the server is available then you could link the new profile

 using GameSparks.Api.Requests;
 using GameSparks.Api.Messages;
 using GameSparks.Api.Responses;
 using GameSparks.Core;

public void Awake()
{
    FB.Canvas.SetAspectRatio(9,16,FBScreen.CenterHorizontal());
    if (!FB.IsInitialized)
    {
        FB.Init(FacebookLogin);
    }
    else
    {
        FacebookLogin();
    }
}

public void FacebookLogin()
{
    if (!FB.IsLoggedIn)
    {
        FB.Login("email", GameSparksLogin);
    }
}

public void GameSparksLogin(FBResult result)
{
    StartCoroutine (GameSparksLoginProcess ());

}

IEnumerator GameSparksLoginProcess(){
    GS.Reset ();
    float i = 0;
    while (true) {
        if(!(GS.Available)){
            i += 0.2f;
            yield return new WaitForSeconds(0.2f);
        }else{
            Debug.Log("wait: "+i+" seconds");
            break;
        }
    }
    if (FB.IsLoggedIn)
    {
        new FacebookConnectRequest().SetAccessToken(FB.AccessToken).SetDoNotLinkToCurrentPlayer(false)
            .Send((response) =>
                  {
                if (response.HasErrors)
                {
                    Debug.Log("Something failed when connectiong with Facebook");
                }
                else
                {
                    Debug.Log("GameSparks Facebook Login Successful");
                }
            });
    }
}