Guest Login
Let your players jump straight into the game and register a session for them on the LootLocker backend.
If you're not using any specific first party platform or just want something simple, you can use our Guest Login feature to create player sessions.
Guest Login provides the player with a simple re-usable session which supports most of LootLocker's features, with the exception of platform specific features such as payments through Steam etc.
Unity
Unreal
We'll start by creating a new empty Game Object in your scene and calling it GameManager. Feel free to skip this if you already have a GameManager or similar in your game.

Then in this new GameObject you can add a new script called GameManager

Open up your new script in your editor of choice and add the following code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LootLocker.Requests;
public class GameManager : MonoBehaviour
{
void Start()
{
LootLockerSDKManager.StartGuestSession((response) =>
{
if (!response.success)
{
Debug.Log("error starting LootLocker session");
return;
}
Debug.Log("successfully started LootLocker session");
});
}
}
To confirm that everything is running without errors, you can start your game and check the console for the correct Debug.Log message.
Above is an example of how to implement Guest Login using blueprints in Unreal Engine. For an example you can copy and paste into your editor, look here.
You need to exchange the
TriggerGuestLogin
event for whatever event you want to use to trigger the login flow. For Guest Login without a specific identifier you could, for example, trigger it on the BeginPlay
event.Remove the node "Optional: Set Player Identifier". The
Guest Login
node can take a Player Identifier input, and if you supply one the player will be logged in with that identifier. Note however that this needs to be unique for each player and there is no authentication tied to the identifier. If you do not input a player identifier a unique one will be generated for you and remembered between game starts.For subsequent calls to different LootLocker methods you will want to create variables from the Player Id and Player Identifier outputs.
We recommend branching the completed events on the success flag, and if you do this you will probably want to add error handling in case the request fails.
Congratulations - you have now started using LootLocker in your game with Guest Login! Next up we suggest you look at our feature set, and decide which ones you want to use in your game.
Last modified 9mo ago