-
Notifications
You must be signed in to change notification settings - Fork 0
Template Class
Jiufen edited this page Mar 9, 2021
·
1 revision
For the user Login PlayFab recommends to use this template to start creating the login of your app:
using Unity.Entities;
using PlayFab;
using PlayFab.ClientModels;
using UnityEngine;
public class PlayFabLogin : MonoBehaviour
{
public void Start()
{
//Note: Setting title Id here can be skipped if you have set the value in Editor Extensions already.
if (string.IsNullOrEmpty(PlayFabSettings.TitleId)){
PlayFabSettings.TitleId = "144"; // Here goes your own titleId from PlayFab Game Manager
}
var request = new LoginWithCustomIDRequest { CustomId = "GettingStartedGuide", CreateAccount = true};
PlayFabClientAPI.LoginWithCustomID(request, OnLoginPlayFabSuccess, OnLoginPlayFabFailure);
}
private void OnLoginPlayFabSuccess(LoginResult result)
{
Debug.Log("Congratulations, you made your first successful API call!");
}
private void OnLoginPlayFabFailure(PlayFabError error)
{
Debug.LogWarning("Something went wrong with your first API call. :(");
Debug.LogError("Here's some debug information:");
Debug.LogError(error.GenerateErrorReport());
}
}In the next section of the wiki we are going to explain how to modify this code to add a real authentication service.
Home
C#
Game Design Patterns
- Command
- Flyweight pattern & Scriptable Objects
- Observer pattern
- State pattern
- Object Pool pattern
- Factory pattern
ECS
PlayFab
- Introduction
- Template Class
- Player Authentication
- Mobile Authentication
- Player Statistics
- Leaderboard
- Player Data
- Friends
Mirror