29 lines
696 B
C#
29 lines
696 B
C#
using Unity.Services.Core;
|
|
using System.Threading.Tasks;
|
|
using Unity.Services.Authentication;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace Darkmatter.Presentation
|
|
{
|
|
public class LeaderBoardInitializer : MonoBehaviour
|
|
{
|
|
private async void Awake()
|
|
{
|
|
await Init();
|
|
}
|
|
|
|
private async Task Init()
|
|
{
|
|
await UnityServices.InitializeAsync();
|
|
if (!AuthenticationService.Instance.IsSignedIn)
|
|
{
|
|
await AuthenticationService.Instance.SignInAnonymouslyAsync();
|
|
}
|
|
PlayerPrefs.SetString("PlayerID", AuthenticationService.Instance.PlayerId);
|
|
PlayerPrefs.Save();
|
|
}
|
|
}
|
|
}
|
|
|