본문 바로가기
개발/Playfab

유니티 플레이팹 통계 저장 불러오기 Playfab GetStatistics 간단 사용법

by SPNK 2022. 7. 2.
반응형

플레이팹 로그인이 되었다는 가정하에 진행

 

유니티 플레이팹 게스트 로그인 Playfab Sign In with Guest Login 간단 사용법

코드 작성 using PlayFab; using PlayFab.ClientModels; using PlayFab.Json; using PlayFab.ProfilesModels; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using EntityKey = PlayFab.ProfilesMod

parksh3641.tistory.com

 


저장

    public void UpdatePlayerStatistics(string key, int value)
    {
        PlayFabClientAPI.UpdatePlayerStatistics(new UpdatePlayerStatisticsRequest
        {
            Statistics = new List<StatisticUpdate>
            {
                new StatisticUpdate { StatisticName = key, Value = value },
            }
        },
        result =>
        {
            Debug.Log("User statistics updated");
        },
        error =>
        {
            Debug.LogError(error.GenerateErrorReport());
        });
    }

 

불러오기

    public void GetStatistics()
    {
        PlayFabClientAPI.GetPlayerStatistics(
           new GetPlayerStatisticsRequest(),
           (Action<GetPlayerStatisticsResult>)((result) =>
           {
               foreach (var statistics in result.Statistics)
               {
                   switch (statistics.StatisticName)
                   {

                   }
                   
                   if(statistics.Equals(""))
                   {
                   
                   }
               }
           }), DisplayPlayfabError);
    }

 

반응형

댓글