플레이팹 로그인이 되었다는 가정하에 진행
유니티 플레이팹 게스트 로그인 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
공통
private void DisplayPlayfabError(PlayFabError error) => Debug.LogError("error : " + error.GenerateErrorReport());
저장
void SaveJsonToPlayfab()
{
DataContent content = new DataContent();
content.name = "안녕하세요";
content.value = 10;
content.isCheck = true;
Dictionary<string, string> dataDic = new Dictionary<string, string>();
dataDic.Add("DataContent", JsonUtility.ToJson(content));
SetUserData(dataDic);
}
public void SetUserData(Dictionary<string, string> data)
{
var request = new UpdateUserDataRequest() { Data = data, Permission = UserDataPermission.Public };
try
{
PlayFabClientAPI.UpdateUserData(request, (result) =>
{
Debug.Log("Update Player Data!");
}, DisplayPlayfabError);
}
catch (Exception e)
{
Debug.LogError(e.Message);
}
}
불러오기
public void GetUserData()
{
var request = new GetUserDataRequest() { PlayFabId = playfabId };
PlayFabClientAPI.GetUserData(request, (result) =>
{
foreach (var eachData in result.Data)
{
string key = eachData.Key;
if (eachData.Key.Contains("DataContent"))
{
DataContent content = JsonUtility.FromJson<DataContent>(eachData.Value.Value);
Debug.Log(content);
}
}
}, DisplayPlayfabError);
}
참고할만한 글
유니티 플레이팹 구글 로그인 Playfab Sign In with Google Login 간단 구현
구글 로그인 SDK 설치 https://github.com/playgameservices/play-games-plugin-for-unity/tree/master/current-build GitHub - playgameservices/play-games-plugin-for-unity: Google Play Games plugin for Unity Google Play Games plugin for Unity. Contribute t
parksh3641.tistory.com
유니티 플레이팹 애플 로그인 Playfab Sign ln with Apple Login 간단 구현
애플 SDK https://github.com/lupidan/apple-signin-unity/releases/tag/v1.4.2 Release Sign in with Apple Unity Plugin v1.4.2 · lupidan/apple-signin-unity Changed Handles empty NSPersonNameComponents sent by Apple when not requesting a name, to be nil nativ
parksh3641.tistory.com