leaderboard feature added
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user