- Notifications
You must be signed in to change notification settings - Fork 5
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
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,statusLoginreturns the resultSuccessful: Login successful andserverCodehas valueFailed: Login failed andserverCodeis empty