All pages
Powered by GitBook
1 of 3

Loading...

Loading...

Loading...

Unity

Unity integration

Introduction

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

Email Login/Logout

using RGN.Modules.SignIn;

public class EmailLoginLogout : MonoBehaviour
{
    public void EmailSignIn()
    {
        // This call will open a web form
        // Handle the result in RGNCore.I.AuthenticationChanged event callback
        EmailSignInModule.I.TryToSignIn();
    }
    public void EmailSignOut()
    {
        EmailSignInModule.I.SignOut();
    }
}
using RGN;
using RGN.Modules.SignIn;
using UnityEngine;

public class AuthenticationChangedController : MonoBehaviour
{
    private void OnEnable()
    {
        RGNCore.I.AuthenticationChanged += OnAuthenticationChangedAsync;
    }
    private void OnDisable()
    {
        RGNCore.I.AuthenticationChanged -= OnAuthenticationChangedAsync;
    }

    private async void OnAuthenticationChangedAsync(AuthState authState)
    {
        switch (authState.LoginState)
        {
            case EnumLoginState.Success:
                Debug.Log("User is logged in");
                // You can start retrieving some data here
                break;
            case EnumLoginState.NotLoggedIn:
                Debug.Log("User is not logged in");
                break;
            case EnumLoginState.Error:
                Debug.LogError("On Auth error: " + authState.LoginState +
                    ", error: " + authState.LoginResult);
                break;
            default:
                Debug.LogError("Unhandled Login State: " + authState.LoginState);
                break;
        }
    }
}

Unreal

Unreal integration

Introduction

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

By default, the project is configured to automatically log into a guest account. This feature is enabled in the plugin settings.

If you require more control over this process, you can disable the checkbox and manually manage guest account logins.

Email login

Authentication

Integration Guide

Email login posted by Car3manPLAY | blueprintUE | PasteBin For Unreal Engineblueprintue
Guest login posted by Car3manPLAY | blueprintUE | PasteBin For Unreal Engineblueprintue
Logo
Logo