question

Mr Sham avatar image
Mr Sham asked

How to use Search API with continuation token in unity C#?

I have been searching everywhere and cant find any example of using continuationtoken for unity c#.

Also playfab unity scene example is using economy v1.

apis
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

·
Xiao Zha avatar image
Xiao Zha answered

Here is a code example you may refer to:

 public void Test()
     {
    
         PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest
         {
             CustomId = "test"
         }, re =>
         {
             Debug.Log("LoginSuccess");
    
             PlayFabEconomyAPI.SearchItems(new PlayFab.EconomyModels.SearchItemsRequest
             {
    
             }, result =>
             {
                 Debug.Log(result.ContinuationToken);
    
                 //You may process the Items from the result at here
    
                 SearchItemLoop(result.ContinuationToken);
    
             }, error =>
             {
                 Debug.Log(error.GenerateErrorReport());
             });
    
         }, er =>
         {
             Debug.Log(er.GenerateErrorReport());
         });
            
     }
    
     public void SearchItemLoop(string continuationToken)
     {
         if (continuationToken != null)
         {
             PlayFabEconomyAPI.SearchItems(new PlayFab.EconomyModels.SearchItemsRequest
             {
                 ContinuationToken = continuationToken
             }, result =>
             {
                 Debug.Log(result.ContinuationToken);
    
                 //You may process the Items from the result at here
    
                 SearchItemLoop(result.ContinuationToken);
    
             }, error =>
             {
                 Debug.Log(error.GenerateErrorReport());
             }) ;
         }
         else
         {
             Debug.Log("Finish");
         }
     }
10 |1200

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

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.