6labs SDK for Unreal

This guide covers integrating the 6labs SDK into your Unreal Engine game: installing the plugin, starting and controlling observation, and sending gameplay events.

Supported Platforms

The 6labs SDK for Unreal Engine observes gameplay on the following platform:

  • Windows 11 with DirectX 12

Prerequisites

Before integrating the 6labs SDK, ensure your development environment and project meet the following requirements:

  • Unreal Engine 5.7 — any 5.7.x release.
    • If your project is on another engine version, such as 5.6.x or 5.8.x, reach out to 6labs support.

1. Download and Import the Module

The 6labs SDK is provided as an Unreal Engine plugin.

Add the module to your Unreal project:

  1. Download the latest version v2.3.5 of the 6labs SDK for Unreal.
  2. Extract the plugin into your project's Plugins directory (YourProject/Plugins/SixLabsSDK/).
  3. Confirm that the plugin is enabled:
    • In the Unreal Editor, go to Edit > Plugins.
    • Search for “6labs SDK” and confirm it is enabled.
  4. Add module dependency:
    • In your game module's Build.cs, add: PublicDependencyModuleNames.Add("SixLabsSDK");

2. Start Observing Gameplay

Use the StartSession() method to start observing gameplay, as illustrated below.

// MyGameInstance.h
UFUNCTION()
void OnStartSessionComplete(ESixLabsSdkResponse Response, const FString& ErrorMessage);

// MyGameInstance.cpp
#include "SixLabsSubsystem.h"
if (USixLabsSubsystem* SixLabs = GetSubsystem<USixLabsSubsystem>())
{
    FSixLabsLifecycleComplete OnComplete;
    OnComplete.BindDynamic(this, &UMyGameInstance::OnStartSessionComplete);

    SixLabs->StartSession(TEXT("<player_in_game_id>"), TEXT("<developer_payload>"), OnComplete);
}

void UMyGameInstance::OnStartSessionComplete(ESixLabsSdkResponse Response, const FString& ErrorMessage)
{
    // Response == ESixLabsSdkResponse::SIXLABS_SUCCESS means StartSession() completed successfully
    // handle result
    // SixLabs->GetSdkState() gives you the SDK's current state
}

Important Information

  • If InGameId is not passed, the observed session may be discarded and will not be used for AI analysis. Without it, sessions cannot be attributed to a player, which is required for downstream insights.
  • Ensure that you obtain user consent before observing gameplay. The SDK does not automatically request permission; consent handling must be implemented in your game logic.
  • As a suggested best practice, you may include a disclosure of gameplay observation in your game's EULA or privacy policy.
  • To properly test it, you need to create a platform-specific build and run it on a physical device. During Play-In-Editor sessions, StartSession() invokes OnComplete with SIXLABS_ERROR_NOT_SUPPORTED instead.
  • Please note that all SDK methods can also be called from Blueprint.
ReferenceStartSession()Requires: SDK_STATE_IDLE
void StartSession(
    const FString& InGameId,
    const FString& DeveloperPayload,
    const FSixLabsLifecycleComplete& OnComplete);

Parameters

Parameter Type Required Description
InGameId FString No An optional but recommended user identifier. If omitted, the session may be discarded and will not be used for AI analysis.
DeveloperPayload FString No Optional developer-defined metadata associated with the session. This value is forwarded as-is with the session request and can be used to attach custom tracking or contextual information. Providing richer DeveloperPayload can significantly improve AI-powered analysis and session understanding. See the Developer Payload Example page for detailed use cases and JSON examples.
Example:
  • Acquisition channel
  • Campaign ID
  • User segment (e.g., new, returning, whale)
  • A/B test variant (e.g., variant_a, variant_b) — split users into cohorts and compare gameplay metrics across them in the 6labs dashboard.
  • Internal reference identifiers
OnComplete FSixLabsLifecycleComplete Yes Invoked once the call completes, whether it succeeds or fails. See Callback Type. In Blueprint, connecting the callback pin is optional.

Callback Response

The callback is asynchronous and provides the result through Response and ErrorMessage.

Response Description
SIXLABS_SUCCESS The session started successfully.
SIXLABS_ERROR_STATE_NOT_IDLE The SDK wasn't in SDK_STATE_IDLE — a session is already running, it's paused, or a previous one is still stopping. Use ResumeSession() to continue the paused session.
SIXLABS_ERROR_NOT_SUPPORTED StartSession() was called where gameplay observation is not supported, such as a Play-In-Editor session.
SIXLABS_ERROR_SESSION_FAILED The request was accepted, but the observation session could not start and the SDK returned to SDK_STATE_IDLE. This may occur due to session creation failure, device limitations, an outdated SDK version, network issues, or any other initialization failure.

3. Set In-Game ID

Use the SetInGameId() method to associate a player's in-game ID with an existing observation session. This is typically required when the SDK is initialized before the user account is created, and you want to link the signed-in user to the session that is already in progress.

if (USixLabsSubsystem* SixLabs = GetSubsystem<USixLabsSubsystem>())
{
    SixLabs->SetInGameId(TEXT("<player_in_game_id>"));
}

Note

  • If InGameId was provided during StartSession(), calling SetInGameId() will overwrite the previously set value for the current session.
ReferenceSetInGameId()
void SetInGameId(const FString& InGameId);

Parameters

Parameter Type Required Description
InGameId FString Yes The player's in-game identifier to associate with the current session.

4. Send Game Events

Use the SendGameEvent() method to log a custom gameplay event during an active observation session. Events are attached to the session and can be used to correlate specific gameplay moments during analysis.

const bool bAccepted = SixLabs->SendGameEvent(TEXT("<event_name>"), TEXT("<event_data_as_json>"));
if (!bAccepted)
{
    // the event was not sent; see the conditions below
}
ReferenceSendGameEvent()
bool SendGameEvent(
    const FString& EventName,
    const FString& EventDataJson);

Parameters

Parameter Type Required Description
EventName FString Yes The name of the custom event to log.
EventDataJson FString Yes A JSON-encoded string containing additional data associated with the event.

Returns

Value Description
true The event was accepted and queued for upload.
false The event was rejected, for example if EventName is empty.

5. Advanced Controls

StartSession() begins observing gameplay for a new session. Use PauseSession(), ResumeSession(), and StopSession() to control that session afterward based on your requirements.

5.1 PauseSession

Use the PauseSession() method to pause gameplay observation.

const ESixLabsSdkResponse Response = SixLabs->PauseSession();
if (Response != ESixLabsSdkResponse::SIXLABS_SUCCESS)
{
    // the SDK was not capturing; see the responses below
}

Important Information

  • Pauses the gameplay observation.
  • You can call ResumeSession() again later to resume gameplay observation.
ReferencePauseSession()Requires: SDK_STATE_CAPTURING
ESixLabsSdkResponse PauseSession();

Returns

Value Description
SIXLABS_SUCCESS The call was accepted and acted on.
SIXLABS_ERROR_STATE_NOT_CAPTURING Returned when the SDK is not in SDK_STATE_CAPTURING — for example if gameplay observation is not running, the session is already paused, or a stop is already in progress. See Session Lifecycle for the full list of states and response codes.

5.2 ResumeSession

Use the ResumeSession() method to continue a session that was previously paused with PauseSession().

// MyGameInstance.h
UFUNCTION()
void OnResumeSessionComplete(ESixLabsSdkResponse Response, const FString& ErrorMessage);

// MyGameInstance.cpp
#include "SixLabsSubsystem.h"
if (USixLabsSubsystem* SixLabs = GetSubsystem<USixLabsSubsystem>())
{
    FSixLabsLifecycleComplete OnComplete;
    OnComplete.BindDynamic(this, &UMyGameInstance::OnResumeSessionComplete);

    SixLabs->ResumeSession(OnComplete);
}

void UMyGameInstance::OnResumeSessionComplete(ESixLabsSdkResponse Response, const FString& ErrorMessage)
{
    // Response == ESixLabsSdkResponse::SIXLABS_SUCCESS means ResumeSession() completed successfully
    // handle result
    // SixLabs->GetSdkState() gives you the SDK's current state
}
ReferenceResumeSession()Requires: SDK_STATE_PAUSED
void ResumeSession(const FSixLabsLifecycleComplete& OnComplete);

Parameters

Parameter Type Required Description
OnComplete FSixLabsLifecycleComplete Yes Invoked once the call completes, whether it succeeds or fails. See Callback Type. In Blueprint, connecting the callback pin is optional.

Callback Response

The callback is asynchronous and provides the result through Response and ErrorMessage.

Response Description
SIXLABS_SUCCESS The session resumed successfully.
SIXLABS_ERROR_STATE_NOT_PAUSED The SDK wasn't in SDK_STATE_PAUSED, so there was no paused session to continue.
SIXLABS_ERROR_SESSION_FAILED The request was accepted, but the paused session could not resume and the SDK returned to SDK_STATE_IDLE. This may occur due to a session or runtime failure, network issues, or another failure that prevents the session from resuming.

5.3 StopSession

Use the StopSession() method to permanently end the current session. Unlike PauseSession(), a stopped session cannot be continued with ResumeSession() — starting a new session requires calling StartSession() again.

// MyGameInstance.h
UFUNCTION()
void OnStopSessionComplete(ESixLabsSdkResponse Response, const FString& ErrorMessage);

// MyGameInstance.cpp
#include "SixLabsSubsystem.h"
if (USixLabsSubsystem* SixLabs = GetSubsystem<USixLabsSubsystem>())
{
    FSixLabsLifecycleComplete OnComplete;
    OnComplete.BindDynamic(this, &UMyGameInstance::OnStopSessionComplete);

    SixLabs->StopSession(OnComplete);
}

void UMyGameInstance::OnStopSessionComplete(ESixLabsSdkResponse Response, const FString& ErrorMessage)
{
    // Response == ESixLabsSdkResponse::SIXLABS_SUCCESS means StopSession() completed successfully
    // handle result
    // SixLabs->GetSdkState() gives you the SDK's current state
}
ReferenceStopSession()Requires: SDK_STATE_CAPTURING / SDK_STATE_PAUSED
void StopSession(const FSixLabsLifecycleComplete& OnComplete);

Parameters

Parameter Type Required Description
OnComplete FSixLabsLifecycleComplete Yes Invoked once the call completes, whether it succeeds or fails. See Callback Type. In Blueprint, connecting the callback pin is optional.

Callback Response

The callback is asynchronous and provides the result through Response and ErrorMessage.

Response Description
SIXLABS_SUCCESS The call was accepted and the session has ended.
SIXLABS_ERROR_STATE_NOT_CAPTURING The SDK wasn't in SDK_STATE_CAPTURING or SDK_STATE_PAUSED, so there was no active or paused session to stop.

6. Session Lifecycle

The SDK moves through the following states. Which methods you can call, and what they return, depends on the current state:

  • You can check the current SDK state at any time using GetSdkState(), which returns an ESixLabsSdkState.
  • StartSession(), PauseSession(), ResumeSession(), and StopSession() can only be called from valid SDK states. Calling an operation from an invalid state returns an error.
  • PauseSession() returns an ESixLabsSdkResponse directly. StartSession(), ResumeSession(), and StopSession() return their result through the OnComplete callback.
  • The OnComplete callback is called asynchronously on the game thread.

6.1 Callback Type

FSixLabsLifecycleComplete is a dynamic delegate that receives the following two parameters:

Parameter Type Description
Response ESixLabsSdkResponse The outcome of the call. See Response Codes.
ErrorMessage const FString& Empty on success; describes the failure otherwise.

6.2 States

The following states describe the SDK's lifecycle. The current state determines which operations the SDK accepts.

State Value Description
SDK_STATE_IDLE 100 The SDK is not observing gameplay. This is the default state and the state returned to after a session stops or fails to start.
SDK_STATE_CAPTURING 101 The SDK is actively observing gameplay. This includes the active session and background processing such as buffering and uploading data.
SDK_STATE_STOPPING 102 The session is stopping. The SDK is finishing any remaining processing before returning to SDK_STATE_IDLE.
SDK_STATE_PAUSED 103 The session is paused. Gameplay observation is temporarily stopped, but the session remains open and previously observed data can continue uploading.

6.3 Response Codes

The following response codes indicate the outcome of a lifecycle method call.

Response Value Raised by What to do
SIXLABS_SUCCESS 0 All Nothing — the call was accepted and completed. For StopSession(), the session has ended.
SIXLABS_ERROR_STATE_NOT_IDLE 1 StartSession() A session is already running, paused, or still stopping. Check GetSdkState(); call ResumeSession() if it is paused.
SIXLABS_ERROR_STATE_NOT_CAPTURING 2 PauseSession(), StopSession() The SDK is not observing. Safe to ignore when the call comes from a lifecycle hook that can fire without a session. StopSession() can also end a paused session.
SIXLABS_ERROR_NOT_SUPPORTED 3 StartSession() Gameplay observation is not available here — currently a Play-In-Editor session. Return early; do not retry.
SIXLABS_ERROR_STATE_NOT_PAUSED 4 ResumeSession() The SDK is not paused. Call StartSession() instead when the state is SDK_STATE_IDLE.
SIXLABS_ERROR_SESSION_FAILED 5 StartSession(), ResumeSession() The request was accepted but the session could not start, and the SDK is back in SDK_STATE_IDLE. It arrives through OnComplete, not as an immediate rejection. Log ErrorMessage and retry at the next natural break; common causes are a low-end device, an outdated SDK version, and network issues.
Text copied to clipboard
Questions? Please reach out to us at dev-support@6labs.ai