# For Unity Apps

Overview

The Ramper Unity SDK is a no-code integration solution for Unity projects to have embedded Web3 wallet and dapp-to-wallet signatures signing within their app, allowing their users to instantly own a self-custodial wallet just by signing in with Email or SSO (Gmail, Facebook, Twitter, Apple ID, Telegram). Onboarding Web2 users to onchain games has been never this easy!

## Supported platform

* Android
* iOS

## Installation

Download and Import: Download the **unity-ramper-latest.unitypackage** and import it into your Unity project.

{% embed url="<https://game-sdk.static.cyborg.game/unity-ramper-v2.1.2_b.unitypackage>" %}

## Setup

After installation, you need to configure the SDK settings.

**1. Open the Settings Asset:**

Go to the Unity top menu and select Ninety Eight > Ramper SDK Setting.

**2. Configure the Settings:**

* App ID: Enter the appId provided by Ramper.
* Game Slug (Optional for Games not connected to Ninety Eight game server): Enter the gameSlug provided by Ninety Eight.
* Is Debug: Toggle this option to enable or disable debug logs.

Demo Wallet: For testing in the Unity editor, enter a fixed wallet address to simulate wallet interactions. These settings ensure that your SDK is properly configured for use within your Unity project.

## Usage

### **Connecting to a Wallet**

#### **Basic login method**

Use the Login method to connect to a Web3 wallet. This method opens a web view for the user to authenticate their wallet.

**Parameters**

* **message**: The message to sign with the wallet. An empty string is acceptable.

```jsx
C98SDK.Ins.Login(message, dataCallback =>
{
   if (connectCallback.success)
    {
        Debug.Log("Successfully connected: " + connectCallback.data.wallets.ethereum.publicKey);
    }
    else
    {
        Debug.LogError("Failed to connect. error: " + connectCallback.error);
    }
});
```

#### **Login direct with Provider**

LoginDirect is a function that supports custom social login buttons in your app.

**Parameters**

* provider: The provider directs to the login method for Ramper.
* message: The message to sign with the wallet. An empty string is acceptable.

```jsx
C98SDK.Ins.LoginDirect("google", message, dataCallback =>
{
   if (connectCallback.success)
    {
        Debug.Log("Successfully connected: " + connectCallback.data.wallets.ethereum.publicKey);
    }
    else
    {
        Debug.LogError("Failed to connect. error: " + connectCallback.error);
    }
});
```

We support the most popular providers: Google, Apple, Facebook, Telegram and Email.

#### **Signing a Message**

The SignMessage method allows you to sign messages, which is essential for authentication and transaction verification in Web3 applications.

```jsx
C98SDK.Ins.SignMessage("Your message here", (signMessageCallback) =>
{
    if (signMessageCallback.success)
    {
        Debug.Log("Message signed: " + signMessageCallback.signature);
    }
    else
    {
        Debug.LogError("Failed to sign message.");
    }
});

```

#### **Signing a Transaction**

You can sign transactions using the SignTransaction method. This is critical for executing actions on the blockchain.

```jsx
C98SDK.Ins.SignTransaction(transactionData, (signTransactionCallback) =>
{
    if (signTransactionCallback.success)
    {
        Debug.Log("Transaction signed: " + signTransactionCallback.transactionHash);
    }
    else
    {
        Debug.LogError("Failed to sign transaction.");
    }
});

```

### Dependencies

* Unity: Version 2020.3 or higher.
* WebView: The SDK leverages a web view for user authentication.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ramper.xyz/embedded-wallet-sdk/quickstart/for-unity-apps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
