> For the complete documentation index, see [llms.txt](/llms.txt).

# Embedded Wallets SDK for Unreal Engine

## Overview[​](#overview "Direct link to Overview")

MetaMask Embedded Wallets SDK (formerly Web3Auth Plug and Play) provides a seamless authentication experience for Unreal Engine game applications with social logins, external wallets, and more. Our Unreal SDK, written in C++, simplifies how you connect users to their preferred wallets and manage authentication state across all mobile platforms.

## Requirements[​](#requirements "Direct link to Requirements")

- Unreal Engine `v5.3.1` with Xcode 15
- [Epic Game Launcher](https://www.unrealengine.com/en-US/download) to download Unreal library
- Basic knowledge of C++ and Unreal Engine Development

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

- Set up your project on the [Embedded Wallets dashboard](https://developer.metamask.io/)

tip

See the [dashboard setup](/embedded-wallets/dashboard/) guide to learn more.

## Installation[​](#installation "Direct link to Installation")

Install the Web3Auth Unreal Engine SDK using one of the following methods:

### Git clone installation[​](#git-clone-installation "Direct link to Git clone installation")

Follow these instructions to install the `web3auth-unreal-sdk` plugin:

1. Close your existing Unreal Engine app.
2. Create a directory in your app root called Plugins.
3. Clone with:

```
git clone https://github.com/Web3Auth/web3auth-unreal-sdk/tree/main/Plugins/Web3AuthSDK ./Plugins/Web3AuthSDK

```

1. Open UE5 Editor, navigator to `Menu` → `Edit` → `Plugins`, check the option to enable Web3AuthSDK.
2. Start your app and it will ask to compile the plugin. Proceed with that.

### Manual installation[​](#manual-installation "Direct link to Manual installation")

Download the [Unreal Package](https://github.com/Web3Auth/web3auth-unreal-sdk/releases) from our latest release and import the package file into your existing Unreal Engine project.

### 1. Configure Embedded Wallets project[​](#1-configure-embedded-wallets-project "Direct link to 1. Configure Embedded Wallets project")

1.1 Go to the [Embedded Wallets dashboard](https://developer.metamask.io/), create or select an Web3Auth project: 1.2 Add `{{SCHEMA}}://{YOUR_APP_PACKAGE_NAME}` to **Allowlist URLs**. 1.3 Copy the `Client ID` for usage later.

### 2. Configure deep link for Android[​](#2-configure-deep-link-for-android "Direct link to 2. Configure deep link for Android")

To setup the Android SDK and NDK for Unreal's editor, [see the Unreal documentation](https://docs.unrealengine.com/5.0/en-US/how-to-set-up-android-sdk-and-ndk-for-your-unreal-engine-development-environment).

- To add redirect URI into your Android app, open the `<Project-path>/Plugins/Web3AuthSDK/Source/Web3AuthSDK_Android.xml` file.
- Find the `<androidManifestUpdates>` tag and inside that, will be a `<data>` tag element. Replace the existing redirect URI with one that you have registered on your Embedded Wallets dashboard.

### 3. Configure deep link for iOS[​](#3-configure-deep-link-for-ios "Direct link to 3. Configure deep link for iOS")

Configure your iOS deep link settings in the appropriate configuration files. Make sure the redirect URI matches what you have registered in your Embedded Wallets dashboard.

## Initialize Web3Auth[​](#initialize-web3auth "Direct link to Initialize Web3Auth")

### 1. Initialize Embedded Wallets instance[​](#1-initialize-embedded-wallets-instance "Direct link to 1. Initialize Embedded Wallets instance")

Initialize the Web3Auth SDK in your Unreal project:

```
#include "Web3AuthSDK.h"

void AYourGameMode::BeginPlay()
{
    Super::BeginPlay();

    // Initialize Web3Auth
    FWeb3AuthOptions Options;
    Options.ClientId = TEXT("YOUR_CLIENT_ID"); // Get your Client ID from MetaMask Developer Dashboard
    Options.Network = TEXT("sapphire_mainnet"); // or "sapphire_devnet"
    Options.RedirectUrl = TEXT("YOUR_SCHEMA://YOUR_APP_PACKAGE_NAME");

    UWeb3AuthSDK::GetInstance()->Initialize(Options);
}

```

### 2. Setup authentication callbacks[​](#2-setup-authentication-callbacks "Direct link to 2. Setup authentication callbacks")

Set up callbacks to handle authentication responses:

```
void AYourGameMode::SetupWeb3AuthCallbacks()
{
    // Bind login success callback
    UWeb3AuthSDK::GetInstance()->OnLoginSuccess.AddDynamic(this, &AYourGameMode::OnWeb3AuthLoginSuccess);

    // Bind login error callback
    UWeb3AuthSDK::GetInstance()->OnLoginError.AddDynamic(this, &AYourGameMode::OnWeb3AuthLoginError);

    // Bind logout callback
    UWeb3AuthSDK::GetInstance()->OnLogout.AddDynamic(this, &AYourGameMode::OnWeb3AuthLogout);
}

UFUNCTION()
void AYourGameMode::OnWeb3AuthLoginSuccess(const FString& PrivateKey, const FString& PublicAddress)
{
    UE_LOG(LogTemp, Warning, TEXT("Web3Auth Login Success - Private Key: %s"), *PrivateKey);
}

UFUNCTION()
void AYourGameMode::OnWeb3AuthLoginError(const FString& Error)
{
    UE_LOG(LogTemp, Error, TEXT("Web3Auth Login Error: %s"), *Error);
}

UFUNCTION()
void AYourGameMode::OnWeb3AuthLogout()
{
    UE_LOG(LogTemp, Warning, TEXT("Web3Auth Logout Success"));
}

```

## Advanced configuration[​](#advanced-configuration "Direct link to Advanced configuration")

The Embedded Wallets Unreal SDK offers a rich set of advanced configuration options:

- **[Custom authentication](/embedded-wallets/sdk/unreal/advanced/custom-authentication/):** Define authentication methods.
- **[Whitelabeling and UI customization](/embedded-wallets/sdk/unreal/advanced/whitelabel/):** Personalize the modal's appearance.
- **[Multi-Factor Authentication (MFA)](/embedded-wallets/sdk/unreal/advanced/mfa/):** Set up and manage MFA.

tip

See the [advanced configuration sections](/embedded-wallets/sdk/unreal/advanced/) to learn more about each configuration option.

- Basic Configuration
- Advanced Configuration

```
FWeb3AuthOptions Options;
Options.ClientId = TEXT("YOUR_CLIENT_ID");
Options.Network = TEXT("sapphire_mainnet"); // or "sapphire_devnet"
Options.RedirectUrl = TEXT("YOUR_SCHEMA://YOUR_APP_PACKAGE_NAME");

UWeb3AuthSDK::GetInstance()->Initialize(Options);

```

```
FWeb3AuthOptions Options;
Options.ClientId = TEXT("YOUR_CLIENT_ID");
Options.Network = TEXT("sapphire_mainnet");
Options.RedirectUrl = TEXT("YOUR_SCHEMA://YOUR_APP_PACKAGE_NAME");

// Set up whitelabel options
FWeb3AuthWhiteLabelOptions WhiteLabelOptions;
WhiteLabelOptions.AppName = TEXT("Your App Name");
WhiteLabelOptions.LogoLight = TEXT("https://your-logo-light.png");
WhiteLabelOptions.LogoDark = TEXT("https://your-logo-dark.png");
WhiteLabelOptions.DefaultLanguage = TEXT("en");
WhiteLabelOptions.Mode = TEXT("auto");

Options.WhiteLabelOptions = WhiteLabelOptions;

UWeb3AuthSDK::GetInstance()->Initialize(Options);

```

## Blockchain integration[​](#blockchain-integration "Direct link to Blockchain integration")

Web3Auth is blockchain agnostic, enabling integration with any blockchain network. Out of the box, Web3Auth offers robust support for both **Solana** and **Ethereum**.

### Ethereum integration[​](#ethereum-integration "Direct link to Ethereum integration")

For Ethereum integration, you can get the private key and use it with Ethereum libraries:

```
UFUNCTION()
void AYourGameMode::OnWeb3AuthLoginSuccess(const FString& PrivateKey, const FString& PublicAddress)
{
    // Use private key for Ethereum transactions
    UE_LOG(LogTemp, Warning, TEXT("Ethereum Private Key: %s"), *PrivateKey);
    UE_LOG(LogTemp, Warning, TEXT("Ethereum Address: %s"), *PublicAddress);
}

```

### Solana integration[​](#solana-integration "Direct link to Solana integration")

For Solana integration, you can get the Ed25519 private key:

```
UFUNCTION()
void AYourGameMode::OnWeb3AuthLoginSuccess(const FString& PrivateKey, const FString& PublicAddress)
{
    // Get Ed25519 private key for Solana
    FString Ed25519PrivKey = UWeb3AuthSDK::GetInstance()->GetEd25519PrivKey();
    UE_LOG(LogTemp, Warning, TEXT("Solana Ed25519 Private Key: %s"), *Ed25519PrivKey);
}

```
