GameService - VirtueSky/sunflower_2 GitHub Wiki
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

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

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
, statusLogin
returns the result
Successful
: Login successful and serverCode
has value
Failed
: Login failed and serverCode
is empty