question

Avinaya Banskota avatar image
Avinaya Banskota asked

How do I construct two PlayFabClientInstanceAPI object, then use these API instances to call the API for two players separately from a single mobile device?I could do it from a PC but not a mobile device..

Leaderboards and Statistics
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

The process is the same on both PC and Mobile. May I ask what is the issue? Is the login identity you have concerns about?

You may also refer to I am making a 2 player (Versus) game.How do I upload each player's score in the leaderboard when playing from the same device? - Playfab Community.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Avinaya Banskota avatar image Avinaya Banskota commented ·
I am making a 2 player bowling game where both players scores need to be uploaded in 2 separate leaderboards.What is the best way to do it from a mobile device?The code below seem to be working but I dont know if this is the right way to login 2 players from one device.I am not too concerned about security issues at the moment.

public PlayFabClientInstanceAPI player1;
public PlayFabClientInstanceAPI player2;



#if UNITY_ANDROID && !UNITY_EDITOR 
        var requestAndroid= new LoginWithAndroidDeviceIDRequest {AndroidDeviceId= ReturnMobileID(),CreateAccount=true};
        player1.LoginWithAndroidDeviceID(requestAndroid,OnLoginMobileSuccess,OnLoginMobileFailure);
        var requestAndroid2=new LoginWithAndroidDeviceIDRequest {AndroidDeviceId= ReturnMobileID(),CreateAccount=true};
        player2.LoginWithAndroidDeviceID(requestAndroid2,OnLoginMobileSuccess,OnLoginMobileFailure);


0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Avinaya Banskota commented ·

It seems fine, and it is the proper way to use instance API. I am not sure how the function ReturnMobileID(), as long as they are different IDs, instance API will work. Please feel free to tell us if you have any issues.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.