To interact with the PLAY API, you will need to be authenticated. This will allow you to store and retrieve additional user data in the PLAY ecosystem.
Guest Login/Logout
If the Auto Guest Login option in RGNUnityInitilizer.cs is checked, logging out from email will automatically sign you back in as guest.
Subscribe Authentication Changed event
usingRGN;usingRGN.Modules.SignIn;usingUnityEngine;publicclassAuthenticationChangedController:MonoBehaviour{privatevoidOnEnable() {RGNCore.I.AuthenticationChanged+= OnAuthenticationChangedAsync; }privatevoidOnDisable() {RGNCore.I.AuthenticationChanged-= OnAuthenticationChangedAsync; }privateasyncvoidOnAuthenticationChangedAsync(AuthState authState) {switch (authState.LoginState) {caseEnumLoginState.Success:Debug.Log("User is logged in"); // You can start retrieving some data herebreak;caseEnumLoginState.NotLoggedIn:Debug.Log("User is not logged in");break;caseEnumLoginState.Error:Debug.LogError("On Auth error: "+authState.LoginState+", error: "+authState.LoginResult);break;default:Debug.LogError("Unhandled Login State: "+authState.LoginState);break; } }}
Email Login/Logout
usingRGN.Modules.SignIn;publicclassEmailLoginLogout:MonoBehaviour{publicvoidEmailSignIn() { // This call will open a web form // Handle the result in RGNCore.I.AuthenticationChanged event callbackEmailSignInModule.I.TryToSignIn(); }publicvoidEmailSignOut() {EmailSignInModule.I.SignOut(); }}