Skip to content

GameService

VirtueSky edited this page Sep 8, 2024 · 4 revisions

What

  • Game service is tools support sign in With Apple Id and Google Play Game Service

Use

  • Attach GooglePlayGamesAuthentication (for Android) and AppleAuthentication (for iOS) to scene

Screenshot 2024-07-29 175700

  • Open tab GameService in Magic Panel to install library and add define symbols

Screenshot 2024-07-29 175748

  • Demo script
publicStatusLoginstatusLogin=StatusLogin.NotLoggedIn;publicstringserverCode="";privatevoidOnEnable(){
#if UNITY_ANDROIDGooglePlayGamesAuthentication.StatusLoginEvent+=OnStatusLogin;GooglePlayGamesAuthentication.ServerCodeEvent+=OnServerCode;
#endif
#if UNITY_IOSAppleAuthentication.StatusLoginEvent+=OnStatusLogin;AppleAuthentication.ServerCodeEvent+=OnServerCode;
#endif
}[Button]publicvoidLogin(){
#if UNITY_ANDROIDGooglePlayGamesAuthentication.Login();
#endif
#if UNITY_IOSAppleAuthentication.Login();
#endif
}privatevoidOnServerCode(stringobj){serverCode=obj;}privatevoidOnStatusLogin(StatusLoginobj){statusLogin=obj;}
  • After calling Login, statusLogin returns the result
    • Successful: Login successful and serverCode has value
    • Failed: Login failed and serverCode is empty

Clone this wiki locally