# 开始使用

> Install and set up the Authentication Software Development Kit for Unreal Engine.

适用于 Unreal Engine 的 Authentication SDK 是适用于 Unreal Engine 的 Unity Gaming Services SDK 插件的一部分。要在 Unreal Engine 中使用 Unity Authentication，首先需要安装 Unity Gaming Services SDK。

### 要求需知##understand-the-requirements

适用于 Unreal Engine 的 Authentication SDK 插件支持 Unreal Engine 版本 4.27 到 5.3。

## 下载 Authentication SDK##download-the-authentication-sdk

### 通过 Unreal Engine Marketplace##from-the-unreal-engine-marketplace-website

1. 登录 [Unreal Engine Marketplace](https://www.unrealengine.com/marketplace/en-US/store)。

2. 访问 [Unity Gaming Services SDK for Unreal Engine Marketplace 页面](https://www.unrealengine.com/marketplace/en-US/product/unity-gaming-services-sdk-for-unreal-engine)。


   **Unity Gaming Services SDK for Unreal Engine Marketplace 页面:**
   ![Unity Gaming Services SDK for Unreal Engine Marketplace 页面](/api/media?file=/authentication-unreal/media/images/unreal-ugs-marketplace-page.png)

3. 选择 **Open in Launcher（在启动器中打开）**。

4. 跳至[通过 Epic Games Launcher](./get-started.md#from-the-epic-games-launcher) 中的步骤 4。

### 通过 Epic Games Launcher##from-the-epic-games-launcher

1. 登录您的 Epic Games Launcher。
2. 在 Epic Games Launcher 中搜索 **Unity Gaming Services SDK for Unreal Engine**。


   **搜索 Unity Gaming Services SDK for Unreal Engine:**
   ![搜索 Unity Gaming Services SDK for Unreal Engine](/api/media?file=/authentication-unreal/media/images/unreal-auth-marketplace-search.png)
3. 访问 Unity Gaming Services SDK for Unreal Engine 页面，然后选择 **Free（免费）**。


   **Unity Gaming Services SDK for Unreal Engine Launcher 页面:**
   ![Unity Gaming Services SDK for Unreal Engine Launcher 页面](/api/media?file=/authentication-unreal/media/images/unreal-ugs-epic-launcher-page.png)
4. 在 Epic Games Launcher 中选择 **Install to Engine（安装到引擎）**。


   **Unity Gaming Services SDK for Unreal Engine 安装按钮:**
   ![Unity Gaming Services SDK for Unreal Engine 安装按钮](/api/media?file=/authentication-unreal/media/images/unreal-ugs-marketplace-install.png)
5. 打开一个新项目或现有项目。
6. 导航到 Plugins（插件）窗口并选中 Unity Gaming Services SDK for Unreal Engine 旁边的复选框。


   **Unity Gaming Services SDK for Unreal Engine 插件窗口:**
   ![Unity Gaming Services SDK for Unreal Engine 插件窗口](/api/media?file=/authentication-unreal/media/images/unreal-ugs-engine-plugin.png)
7. 重新启动 Unreal Engine。

> **Note:**
>
> **注意**：如果您使用从源代码构建的引擎版本，那么您可以通过执行以下操作来访问您的 Marketplace 文件夹：
>
> * 如果使用的是 Windows，则默认路径为：`C:\Program Files\Epic Games\UE_5.3\Engine\Plugins\Marketplace`。MacOS 和 Linux 也有类似的路径。
> * 将 `UnityGamingServicesSDK` 文件夹复制到您的项目 `Plugins` 文件夹中。如果文件夹尚不存在，请在项目根目录下创建。

### 配置 Authentication SDK##configure-the-authentication-sdk

在开始使用 Authentication SDK 之前，您需要注册使用 Unity Gaming Services（Unity 游戏服务）并注册一个项目。

### 注册 UGS##sign-up-for-ugs

> **Note:**
>
> **注意**：如果您已经注册使用 Unity Gaming Services（Unity 游戏服务）并拥有注册的项目，请跳过此步骤。

如果您还没有 Unity 帐户，创建一个帐户并[创建一个新项目](/authentication.md)，以注册使用 Unity Gaming Services（Unity 游戏服务）：

1. 登录 [Unity Dashboard](https://cloud.unity.com/)。
2. 选择侧面板中的 **Explore Services（探索服务）**。
3. 选择顶部横幅中的 \*\*Sign Up（注册）\*\*并按照说明操作。

### 关联您的项目##link-your-project

1. 登录您的 [Unity Dashboard](https://cloud.unity.com/)。
2. 选择标题栏项目名称旁边的齿轮图标来访问项目设置。


   **Project Settings（项目设置）齿轮图标。:**
   ![Project Settings（项目设置）齿轮图标。](/api/media?file=/authentication-unreal/media/images/unreal-auth-project-settings.png)
3. 在 **General（常规）**> \*\*Project Details（项目详细信息）\*\*下，有一个 Project ID 字段。复制该值。


   **Project ID 的 Copy（复制）按钮。:**
   ![Project ID 的 Copy（复制）按钮。](/api/media?file=/authentication-unreal/media/images/unreal-auth-project-id.png)
4. 在 Unreal Engine 编辑器中，转到 **Edit（编辑）**> **Project Settings（项目设置）**> **Plugins（插件）**> **Unity Authentication** > **Unity Project Settings（Unity 项目设置）**。
5. 将复制的值粘贴到 **Unity Project ID** 字段中。
6. 获取 Unity 环境。这是一个可选参数，用于指定您希望 Authentication SDK 与之交互的具体环境。
7. 在 Unity Dashboard 中，转到 **Environments（环境）**> **Your Environments（您的环境）**，然后选择您要使用的环境并复制其名称。这是我们用于环境的标识符。


   **Unity Dashboard 的环境列表。:**
   ![Unity Dashboard 的环境列表。](/api/media?file=/authentication-unreal/media/images/unreal-auth-your-environments.png)
   > **Note:**
   >
   > **注意**：我们复制的是环境名称，而不是环境 ID。在上面的示例中，名称为“testenv”。使用任何其他值都会导致 Authentication 请求失败。
8. 在 Unreal Engine 编辑器中，转到 **Edit（编辑）**> **Project Settings（项目设置）**> **Plugins（插件）**> **Unity Authentication** > **Unity Project Settings（Unity 项目设置）**。
9. 将复制的值粘贴到 \*\*Unity Environment Name（Unity 环境名称）\*\*字段中。

复制这两个字段后，Unreal 编辑器中的项目设置应如下所示：


**Unity Authentication 插件。:**
![Unity Authentication 插件。](/api/media?file=/authentication-unreal/media/images/unreal-sdk-plugins-unity-authentication.png)

\*\*Default Player Profile Name（默认玩家配置文件名称）\*\*字段允许为默认 Authentication 玩家配置文件指定不同的名称。这个字段可以保持不变，或根据您的需要进行自定义。

> **Note:**
>
> **注意**：有效的玩家配置文件名称长度为 1-30 个字符，由字符 a-z、A-Z、0-9、- 和 \_ 组成，不能包含空格。

请参阅[玩家配置文件](./player-profiles.md)以详细了解 Authentication SDK 中的玩家配置文件。

## 下一步##what's-next?

继续进行以下集成之一：

* [C++ 集成](./cpp-integration.md)
* [蓝图集成](./blueprint-integration.md)
