> For the complete documentation index, see [llms.txt](https://playnetwork.gitbook.io/play-sdk-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://playnetwork.gitbook.io/play-sdk-documentation/sdk-integration-guides/user-profile/unity.md).

# Unity

Unity integration

## Introduction

The user profile module is used to store user specific data related to his identity.&#x20;

<details>

<summary>UserProfileData</summary>

* **userId** (string): *Unique READYgg ID for a user. Authenticated user has the same ID accross applications using READYgg.*
* **email** (string): *Email of the authenticated user.*
* **displayName** (string): *Authenticated user share the same display name accross applications using READYgg.*
* **profilePicture** (userProfilePicture): *Authenticated user share the same profile picture accross applications using READYgg.*
* **bio** (string): *Authenticated user share the same bio accross applications using READYgg.*
* **currencies** (List\<Currency>): *Contains all the currencies user collected for your application.*

</details>

#### UserProfileData class methods

* **GetRGNCoinBalance();**&#x20;
  * *Return the amount of rgn-coin for this user.*
* **GetCustomCoinBalance(string currencyName);**&#x20;
  * *Return the amount of your custom currency for this user.*

### **Load User Profile** <a href="#load-user-profile" id="load-user-profile"></a>

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

public class UserProfileExample : MonoBehaviour
{
    public async void LoadUserProfileDataAsync()
    {
        string userId = RGNCore.I.MasterAppUser.UserId;
        UserProfileData userProfileData = await UserProfileModule.I.GetFullUserProfileAsync<UserProfileData>();
        Debug.Log($"Display name : {userProfileData.displayName} \n" +
            $"Bio : {userProfileData.bio} \n" +
            $"Email : {userProfileData.email} \n");
    }
}
```

### Update UserName/Display Name

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

public class UserProfileExamples : MonoBehaviour
{
    private async void UpdateDisplayName()
    {
        string newDisplayName = await UserProfileModule.I.SetDisplayNameAsync("New display name");
        Debug.Log($"Display name : {newDisplayName}");
    }
}
```

### Update User Bio

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

public class UserProfileExamples : MonoBehaviour
{
    private async void UpdateUserBio()
    {
        string newBio = await UserProfileModule.I.SetBioAsync("This is my user description");
        Debug.Log($"Bio : {newBio}");
    }
}
```

### **Retrieve User Currencies**

```csharp
using UnityEngine;
using System.Collections.Generic;
using RGN.Modules.UserProfile;
using RGN.Modules.Currency;

public class UserProfileExamples : MonoBehaviour
{
    private async void GetUserCurrencies()
    {
        List<Currency> currencies = await UserProfileModule.I.GetUserCurrenciesAsync();
        foreach (Currency currency in currencies)
        {
            Debug.Log($"Type : {currency.name} Quantity : {currency.quantity}");
        }
    }
}
```

### "rgn-coin" Currency&#x20;

Similar to other in-game currencies but it can only be obtained by making In-App Purchases - it cannot be earned or given as a reward to players. It is consumed to purchase NFT [Virtual Items](/play-sdk-documentation/sdk-integration-guides/virtual-items.md#virtual-items).\
\
For more details about the rgn-coin, please refer to the [Currency module](/play-sdk-documentation/sdk-integration-guides/currency-iap.md).&#x20;
