-
Notifications
You must be signed in to change notification settings - Fork 3
GameService
VirtueSky edited this page Sep 8, 2024
·
4 revisions
- Game service is tools support sign in
With Apple IdandGoogle Play Game Service
- Attach
GooglePlayGamesAuthentication(for Android) andAppleAuthentication(for iOS) to scene

- Open tab
GameServiceinMagic Panelto install library and add define symbols

- Demo script
public StatusLogin statusLogin = StatusLogin.NotLoggedIn;
public string serverCode = "";
private void OnEnable()
{
#if UNITY_ANDROID
GooglePlayGamesAuthentication.StatusLoginEvent += OnStatusLogin;
GooglePlayGamesAuthentication.ServerCodeEvent += OnServerCode;
#endif
#if UNITY_IOS
AppleAuthentication.StatusLoginEvent += OnStatusLogin;
AppleAuthentication.ServerCodeEvent += OnServerCode;
#endif
}
[Button]
public void Login()
{
#if UNITY_ANDROID
GooglePlayGamesAuthentication.Login();
#endif
#if UNITY_IOS
AppleAuthentication.Login();
#endif
}
private void OnServerCode(string obj)
{
serverCode = obj;
}
private void OnStatusLogin(StatusLogin obj)
{
statusLogin = obj;
}- After calling
Login,statusLoginreturns the result-
Successful: Login successful andserverCodehas value -
Failed: Login failed andserverCodeis empty
-