You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PlumberUltimateAds/Assets/Scripts/Dev/PlayFab/PlayFabInit.cs

40 lines
954 B
C#

using System.Collections;
using System.Collections.Generic;
using PlayFab;
using PlayFab.ClientModels;
using UnityEngine;
public class PlayFabInit : MonoBehaviour
{
public string playFabTitleId = "7D3B9"; // Replace with your PlayFab Title ID
void Start()
{
if (string.IsNullOrEmpty(PlayFabSettings.TitleId))
{
PlayFabSettings.TitleId = playFabTitleId;
}
Login();
}
void Login()
{
var request = new LoginWithCustomIDRequest
{
CustomId = SystemInfo.deviceUniqueIdentifier,
CreateAccount = true
};
PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnLoginFailure);
}
private void OnLoginSuccess(LoginResult result)
{
Debug.Log("Login successful!");
}
private void OnLoginFailure(PlayFabError error)
{
Debug.LogError("Login failed: " + error.GenerateErrorReport());
}
}