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

# KUP unity

{% embed url="<https://github.com/catze-labs/coinbase-kup-unity>" %}

## Overview:

The KUP game server uses PlayFab for asset management and user login functionality. In order to integrate with PlayFab in the Unity client, developers will need to use the PlayFab SDK. The login feature is implemented using the LoginWithEmailAddress function from the PlayFabClientAPI. The player's records are stored in PlayFab and can be saved and loaded using the provided APIs.

## Technology Details:

1. PlayFab - PlayFab is a cloud-based platform for developing and operating live games. It provides a range of features for game developers, including asset management, user login, and statistics tracking.
2. Unity - Unity is a cross-platform game engine used to develop video games and interactive content.
3. PlayFab SDK - The PlayFab SDK is a set of tools and libraries that allows developers to integrate PlayFab functionality into their games. It provides access to the PlayFab API and other features such as client-side data storage and real-time multiplayer support.
4. LoginWithEmailAddress - This function is part of the PlayFabClientAPI and is used to implement login functionality in the KUP game client. It takes an email address and password as input and returns a PlayFabId if the login is successful.
5. PlayFab APIs - The PlayFab APIs are used to save and load player records in the KUP game client. Additional information about these APIs is not provided in the given code snippet.

#### Assets list in use

| Name        | Range                             | Link                                                             |
| ----------- | --------------------------------- | ---------------------------------------------------------------- |
| PlayFab SDK | PlayFab Development Kit for Unity | <https://learn.microsoft.com/ko-kr/gaming/playfab/sdks/unity3d/> |
| Chop Chop   | Unity Open Project                | <https://github.com/UnityTechnologies/open-project-1>            |

KUP game server uses PlayFab. To integrate with PlayFab in the Unity client, you need to use the SDK provided by PlayFab.

Chop Chop was an Open Project conducted by Unity Technology. We implemented it using the open source.

#### User login

You can use PlayFabClientAPI provided by PlayFab SDK to implement login functionality. The login feature is implemented using the LoginWithEmailAddress function. If the login is successful, you can receive the PlayFabId from the results in the callback, and use it in other APIs if necessary. For more information about this function, please refer to the following page.

#### Statistics Save & Load

In the KUP game client, the player's records are stored in PlayFab. The APIs used to save and load records are as follows.

| Name                     | Description                                                                                                                             | Link                                                                                                                          |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Update Player Statistics | Updates the values of the specified title-specific statistics for the user. By default, clients are not permitted to update statistics. | <https://learn.microsoft.com/en-us/rest/api/playfab/client/player-data-management/update-player-statistics?view=playfab-rest> |
| Get Player Statistics    | Retrieves the current version and values for the indicated statistics, for the local player.                                            | <https://learn.microsoft.com/en-us/rest/api/playfab/server/player-data-management/get-player-statistics?view=playfab-rest>    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://kup.gitbook.io/untitled/welcome-to-kup/integration-guide/kup-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.
