# Unity

If you are selling an NFT in your game, it is important to check the following :&#x20;

**Is user authenticated with a email?**

```csharp
using UnityEngine;
using RGN;

public class WalletExamples : MonoBehaviour
{
    private bool IsUserAuthenticatedWithEmail()
    {
        return RGNCoreBuilder.I.CurrentAuthState.AuthProvider == EnumAuthProvider.Email;
    }
}
```

**Is user has a wallet?**

```csharp
using UnityEngine;
using RGN;
using RGN.Modules.Wallets;
using System.Threading.Tasks;

public class WalletExamples : MonoBehaviour
{
    private async Task<bool> IsUserHasBlockchainRequirement()
    {
        bool hasRequirement = await WalletsModule.I.IsUserHasBlockchainRequirementAsync();
        return hasRequirement;
    }
}
```

**Create wallet**

```csharp
using UnityEngine;
using RGN.Modules.Wallets;

public class WalletExamples : MonoBehaviour
{
    private void CreateWallet()
    {
        // This will open the OAuth form for the wallet creation
        WalletsModule.I.CreateWallet();
    }
{
```

**Example flow for NFT purchase**

```csharp
using System.Collections.Generic;
using UnityEngine;
using RGN;
using RGN.Modules.Wallets;
using RGN.Modules.SignIn;
using RGN.Modules.Store;

public class WalletExamples : MonoBehaviour
{
    private async void BuyNFTVirtualItem()
    {
        bool authWithEmail = RGNCoreBuilder.I.CurrentAuthState.AuthProvider == EnumAuthProvider.Email;
        if (!authWithEmail)
        {
            EmailSignInModule.I.TryToSignIn();
            return;
        }

        bool hasBlockchainRequirement = await WalletsModule.I.IsUserHasBlockchainRequirementAsync();
        if (!hasBlockchainRequirement)
        {
            WalletsModule.I.CreateWallet();
            return;
        }

        List<string> virtualItemIds = new List<string> { "myNftVirtualItemId" };
        PurchaseResult purchaseResult = await StoreModule.I.BuyVirtualItemsAsync(virtualItemIds);
    }
}
```


---

# 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://playnetwork.gitbook.io/play-sdk-documentation/sdk-integration-guides/wallets/unity.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.
